On Tuesday 01 July 2008 11:23:48 [EMAIL PROTECTED] wrote:

> Modified:
>    branches/pdd25cx/src/ops/core.ops
>
> Log:
> [pdd25cx] Add range checking to 'local_return' opcode, to require it be
> within the current code segment.
>
>
> Modified: branches/pdd25cx/src/ops/core.ops
> ===========================================================================
>=== --- branches/pdd25cx/src/ops/core.ops      (original)
> +++ branches/pdd25cx/src/ops/core.ops Tue Jul  1 11:23:47 2008
> @@ -270,6 +270,12 @@
>      return_addr = VTABLE_pop_integer(interp, $1);
>      next = INTVAL2PTR(opcode_t *, return_addr);
>
> +    /* The return address must be within the current code segment. */
> +    if (! ( next >= interp->code->base.data
> +            && next < (interp->code->base.data + interp->code->base.size))

This looks like a good place to invert the conditional:

        if (next <   interp->code->base.data
        ||  next >= (interp->code->base.data + interp->code->base.size))

-- c

Reply via email to