Crash if db string is too long

Bug #691412 reported by BlackCow
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gnusim8085
New
Undecided
Unassigned

Bug Description

This program causes GNUsim8085 to crash and close without warning,

jmp start
;data
data: db 01h,02h,03h,04h,05h,06h,07h,08h,09h,0Ah,0Bh,0Ch,0Dh,0Eh,0Fh,10h,11h,12h,13h,14h,15h,16h,17h,18h,19h,1Ah,1Bh,1Ch
;code
start: nop
hlt

It will work up to 1Ah.
If you define up to 1Bh, it will say the program has errors on line 3 (Undefined symbol and DB: Operand error).
Up to 1Ch it will crash with a Segmentation Fault to the terminal.

I'm running version 1.3.6-1 in Ubuntu 10.04

BlackCow (blackcow99)
description: updated
Revision history for this message
ramz (ramanathan-nit) wrote :

This problem is due to the following structure
typedef struct
{
  gint op_num; /* >= 256 */
  gchar op_str[ASM_DS_MAX_OPCODE_LENGTH];

  gint user_args; /* 0 - no arg, n args seperated by comma */

} IdPseudo;

ASM_DS_MAX_OPERAND which is default to 100. If anything over this causes problem.

We need to dynamically change this size based on input (also keeping the max size configurable ... It would be better to add config module for all these ... )

Revision history for this message
BlackCow (blackcow99) wrote :

Yeah, changing the ASM_DS_MAX_OPERAND value to something like 500 does indeed fix the problem (unless I make the string even longer of course!)

Thanks for the quick fix :-)

Changed in gnusim8085:
milestone: none → 1.3.8
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.