X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=execloop.h;h=b75061e50b4633637e8d068c3c8a08305b7798e3;hb=060bddb922c7933f1970828b7fcf3e3a4122d5c8;hp=d134f4379914eed12a171e39f471f3b8d0ac4e45;hpb=08e54038960168f45e64f7f92db0009350cb38c3;p=xonotic%2Fgmqcc.git diff --git a/execloop.h b/execloop.h index d134f43..b75061e 100644 --- a/execloop.h +++ b/execloop.h @@ -16,7 +16,7 @@ #endif #if !defined(PRVM_ERROR) -# define PRVM_ERROR printf +# define PRVM_ERROR prog->vmerror++, printvmerr #endif #if !defined(PRVM_NAME) @@ -50,7 +50,7 @@ while (1) { - prog_function *newf; + prog_section_function *newf; qcany *ed; qcany *ptr; @@ -216,7 +216,7 @@ ptr->_int = OPA->_int; break; case INSTR_STOREP_V: - if (OPB->_int < 0 || OPB->_int + 3 >= prog->entitydata_count) + if (OPB->_int < 0 || OPB->_int + 2 >= prog->entitydata_count) { PRVM_ERROR("%s attempted to write to an out of bounds edict (%i)", PRVM_NAME, OPB->_int); goto cleanup; @@ -232,7 +232,7 @@ case INSTR_ADDRESS: if (OPA->edict < 0 || OPA->edict >= prog->entities) { - PRVM_ERROR ("%s Progs attempted to address an out of bounds edict number", PRVM_NAME); + PRVM_ERROR ("%s Progs attempted to address an out of bounds edict number %i", PRVM_NAME, OPA->edict); goto cleanup; } if ((unsigned int)(OPB->_int) >= (unsigned int)(prog->entityfields)) @@ -271,7 +271,7 @@ PRVM_ERROR ("%s Progs attempted to read an out of bounds edict number", PRVM_NAME); goto cleanup; } - if (OPB->_int < 0 || OPB->_int + 3 >= prog->entityfields) + if (OPB->_int < 0 || OPB->_int + 3 > prog->entityfields) { PRVM_ERROR("%s attempted to read an invalid field in an edict (%i)", PRVM_NAME, OPB->_int); goto cleanup; @@ -357,6 +357,8 @@ } else st = prog->code + PROG_ENTERFUNCTION(newf); + if (prog->vmerror) + goto cleanup; break; case INSTR_DONE: