mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
[gamecode] Add statement bounds checking
Statements can be bounds checked in the one place (jump calculation), but memory accesses cannot as they can be used in lea instructions which should never cause an exception (unless one of lea's operands is OOB).
This commit is contained in:
parent
9d74fcc181
commit
f2b258ba76
1 changed files with 3 additions and 0 deletions
|
@ -1819,6 +1819,9 @@ pr_jump_mode (progs_t *pr, const dstatement_t *st)
|
||||||
jump_offs = OPA(uint) + OPB(int);
|
jump_offs = OPA(uint) + OPB(int);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (pr_boundscheck->int_val && jump_offs >= pr->progs->numstatements) {
|
||||||
|
PR_RunError (pr, "out of bounds: %x", jump_offs);
|
||||||
|
}
|
||||||
return jump_offs - 1; // for st++
|
return jump_offs - 1; // for st++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue