mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 23:11:38 +00:00
Check for null VM pointer accesses.
Currently only four words of "null pointer protection" are available, but it's a start.
This commit is contained in:
parent
a95f679283
commit
1fdc32bb39
1 changed files with 2 additions and 0 deletions
|
@ -257,6 +257,8 @@ PR_LeaveFunction (progs_t *pr)
|
|||
VISIBLE void
|
||||
PR_BoundsCheckSize (progs_t *pr, pointer_t addr, unsigned size)
|
||||
{
|
||||
if (addr < pr->pr_real_params[0] - pr->pr_globals)
|
||||
PR_RunError (pr, "null pointer access");
|
||||
if (addr >= pr->globals_size
|
||||
|| size > (unsigned) (pr->globals_size - addr))
|
||||
PR_RunError (pr, "invalid memory access: %d (0 to %d-%d)", addr,
|
||||
|
|
Loading…
Reference in a new issue