Constrain value range of lj_ir_kptr() to unsigned 32 bit pointers.

Thanks to Peter Cawley.
This commit is contained in:
Mike Pall
2016-04-24 17:32:12 +02:00
parent d8ac6230ed
commit ac42037db0
4 changed files with 9 additions and 16 deletions

View File

@@ -882,12 +882,7 @@ void lj_record_ret(jit_State *J, BCReg rbase, ptrdiff_t gotresults)
static BCReg rec_mm_prep(jit_State *J, ASMFunction cont)
{
BCReg s, top = cont == lj_cont_cat ? J->maxslot : curr_proto(J->L)->framesize;
#if LJ_64
TRef trcont = lj_ir_kptr(J, (void *)((int64_t)cont-(int64_t)lj_vm_asm_begin));
#else
TRef trcont = lj_ir_kptr(J, (void *)cont);
#endif
J->base[top] = trcont | TREF_CONT;
J->base[top] = lj_ir_kptr(J, contptr(cont)) | TREF_CONT;
J->framedepth++;
for (s = J->maxslot; s < top; s++)
J->base[s] = 0; /* Clear frame gap to avoid resurrecting previous refs. */