uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 8b84813c6ea4beb094c2a4c2a09da3e92a7eeb14
parent da4f0e70a5e523019b41a75fc738f9278d39dd4a
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date:   Sat, 19 Feb 2022 00:27:28 +0000

(uxnasm) Raise error when memory is overwritten.

Diffstat:
Msrc/uxnasm.c | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/uxnasm.c b/src/uxnasm.c @@ -193,6 +193,10 @@ writebyte(Uint8 b) fprintf(stderr, "-- Writing in zero-page: %02x\n", b); return 0; } + else if(p.ptr < p.length) { + fprintf(stderr, "-- Memory overwrite: %04x -> %04x\n", p.length, p.ptr); + return 0; + } p.data[p.ptr++] = b; p.length = p.ptr; litlast = 0; @@ -213,6 +217,7 @@ writelitbyte(Uint8 b) if(litlast) { /* combine literals */ Uint8 hb = p.data[p.ptr - 1]; p.ptr -= 2; + p.length = p.ptr; return writeshort((hb << 8) + b, 1); } if(!writebyte(findopcode("LIT"))) return 0;