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:
Bill Currie 2012-12-22 14:24:11 +09:00
parent a95f679283
commit 1fdc32bb39

View file

@ -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,