From c6808e75ed6088e3006c0d6748c1288eebb39c8a Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Wed, 21 Dec 2022 16:37:53 -0600 Subject: [PATCH] Files missed in the last commit. :-P --- 6502.h | 2 ++ direct.c | 10 ++++++++-- object.c | 5 +++++ rmac.c | 5 +++++ rmac.h | 1 + version.h | 2 +- 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/6502.h b/6502.h index bddf065..453c66b 100644 --- a/6502.h +++ b/6502.h @@ -19,6 +19,8 @@ extern void Init6502(); extern int d_6502(); extern void m6502cg(int op); extern void m6502obj(int ofd); +extern void m6502raw(int ofd); +extern void m6502c64(int ofd); #endif // __6502_H__ diff --git a/direct.c b/direct.c index 24c3d93..684607f 100644 --- a/direct.c +++ b/direct.c @@ -628,11 +628,13 @@ allright: { // Parse size and position parameters uint64_t requested_size = -1; // -1 means "not set" for these two + if (*tok++ != ',') { close(fd); return error("expected comma after incbin filename"); } + if (tok != EOL) { if (*tok != ',') @@ -642,12 +644,14 @@ allright: close(fd); return ERROR; } + if ((int64_t)requested_size <= 0 || requested_size > size) { close(fd); return error("invalid incbin size requested"); } } + if (*tok != EOL) { if (*tok++ != ',') @@ -655,6 +659,7 @@ allright: close(fd); return error("expected comma after size parameter"); } + if (*tok != EOL) { if (abs_expr(&pos) != OK) @@ -662,6 +667,7 @@ allright: close(fd); return ERROR; } + if ((int64_t)pos <= 0 || pos > size) { close(fd); @@ -682,7 +688,7 @@ allright: { requested_size = size - pos; } - + // Are we going to read past the end of the file? if (pos + requested_size > size) { @@ -1215,7 +1221,7 @@ int d_ds(WORD siz) if (expr(exprbuf, &eval, &eattr, NULL) < 0) return ERROR; - + // Check to see if the value being passed in is negative (who the hell does // that?--nobody does; it's the code gremlins, or rum, what does it) // N.B.: Since 'eval' is of type uint64_t, if it goes negative, it will diff --git a/object.c b/object.c index 78c225f..f7ac8a7 100644 --- a/object.c +++ b/object.c @@ -831,6 +831,11 @@ for(int j=0; j