X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=direct.c;h=d6d6c3f2e63499d7301253b41f9881eb72daef08;hp=24c3d93d4f1d029941c600019861fc908ff3cdd7;hb=HEAD;hpb=78d0bcae46c1c79ef35d7b32edcaeb6b8ee75e01 diff --git a/direct.c b/direct.c index 24c3d93..c403b48 100644 --- a/direct.c +++ b/direct.c @@ -628,12 +628,14 @@ 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 != 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 @@ -2021,6 +2027,7 @@ int d_56001(void) regtab = reg56tab; regcheck = reg56check; regaccept = reg56accept; + used_architectures |= M56001P | M56001X | M56001Y | M56001L; return 0; } @@ -2052,6 +2059,7 @@ int d_gpu(void) regtab = regrisctab; regcheck = regrisccheck; regaccept = regriscaccept; + //used_architectures |= MGPU; // TODO: Should GPU/DSP have their own dedicated sections in the long run? return 0; } @@ -2083,6 +2091,7 @@ int d_dsp(void) regtab = regrisctab; regcheck = regrisccheck; regaccept = regriscaccept; + //used_architectures |= MDSP; // TODO: Should GPU/DSP have their own dedicated sections in the long run? return 0; } @@ -2355,6 +2364,7 @@ int d_objproc(void) rgpu = 0; // Unset GPU assembly rdsp = 0; // Unset DSP assembly dsp56001 = 0; // Unset 56001 assembly + //used_architectures |= MOP; // TODO: Should OP have its own dedicated section in the long run? return OK; }