Skip to content

Commit 77c3169

Browse files
committed
longstring segfault fix
1 parent 2abcdb9 commit 77c3169

File tree

6 files changed

+34
-3
lines changed

6 files changed

+34
-3
lines changed

src/asm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ enum FORMAT
6363
FORMAT_MAX
6464
};
6565

66-
66+
#define MAXLINE 1024
6767
#define MAX_SYM_LEN 1024
6868

6969
enum ASM_ERROR_EQUATES

src/main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434

3535
static const char dasm_id[] = DASM_ID;
3636

37-
#define MAXLINE 1024
3837
#define ISEGNAME "INITIAL CODE SEGMENT"
3938

4039
/*

src/ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
#include "asm.h"
3131

32-
unsigned char Gen[256];
32+
unsigned char Gen[MAXLINE];
3333
unsigned char OrgFill = DEFORGFILL;
3434
int Glen;
3535

test/longstring.asm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
; Test long strings
2+
;
3+
; This came about due to strings longer than 256 bytes causing
4+
; segfaults, due to overflow of a buffer in the opcode handling.
5+
;
6+
; --Mike Saarna
7+
8+
.processor 6502
9+
.org 0
10+
11+
.byte "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
12+
13+
.end

test/longstring.bin.ref

282 Bytes
Binary file not shown.

test/longstring.hex.ref

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
:1000000031323334353637383930313233343536AE
2+
:100010003738393031323334353637383930313298
3+
:100020003334353637383930313233343536373882
4+
:100030003930313233343536373839303132333480
5+
:100040003536373839303132333435363738393060
6+
:10005000313233343536373839303132333435365E
7+
:100060003738393031323334353637383930313248
8+
:100070003334353637383930313233343536373832
9+
:100080003930313233343536373839303132333430
10+
:100090003536373839303132333435363738393010
11+
:1000A000313233343536373839303132333435360E
12+
:1000B00037383930313233343536373839303132F8
13+
:1000C00033343536373839303132333435363738E2
14+
:1000D00039303132333435363738393031323334E0
15+
:1000E00035363738393031323334353637383930C0
16+
:1000F00031323334353637383930313233343536BE
17+
:1001000037383930313233343536373839303132A7
18+
:0801100033343536373839303D
19+
:00000001FF

0 commit comments

Comments
 (0)