mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Merge pull request #358 from dbrotz/fix-357
Fix buffer overflow when creating patches with long RPN expressions
This commit is contained in:
33
test/asm/long-rpn-expression.asm
Normal file
33
test/asm/long-rpn-expression.asm
Normal file
@@ -0,0 +1,33 @@
|
||||
SECTION "sec", ROM0
|
||||
|
||||
X0 EQUS "0"
|
||||
|
||||
m: MACRO
|
||||
\1 EQUS STRCAT("{X\2}", "+0")
|
||||
ENDM
|
||||
|
||||
n = 0
|
||||
|
||||
REPT $7E
|
||||
n1 = n + 1
|
||||
NSTR EQUS STRSUB("{n}", 2, STRLEN("{n}") - 1)
|
||||
N1STR EQUS STRSUB("{n1}", 2, STRLEN("{n1}") - 1)
|
||||
XN1 EQUS STRCAT("X", "{N1STR}")
|
||||
m XN1, {NSTR}
|
||||
PURGE NSTR, N1STR, XN1
|
||||
n = n + 1
|
||||
ENDR
|
||||
|
||||
; string of 127 zeros separated by plus signs
|
||||
X EQUS "{X7E}"
|
||||
|
||||
db x+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+\
|
||||
X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+\
|
||||
X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+\
|
||||
X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+\
|
||||
X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+\
|
||||
X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+\
|
||||
X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+\
|
||||
X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X
|
||||
|
||||
x db 0
|
||||
0
test/asm/long-rpn-expression.out
Normal file
0
test/asm/long-rpn-expression.out
Normal file
0
test/asm/long-rpn-expression.out.pipe
Normal file
0
test/asm/long-rpn-expression.out.pipe
Normal file
Reference in New Issue
Block a user