Skip to content

Commit

Permalink
Fix maxslots when recording BC_TSETM.
Browse files Browse the repository at this point in the history
Analyzed by Sergey Kaplun. #1025
  • Loading branch information
Mike Pall committed Jul 8, 2023
1 parent 69dadad commit 0cc5fdf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lj_record.c
Expand Up @@ -116,6 +116,7 @@ static void rec_check_slots(jit_State *J)
cTValue *tv = &base[s];
IRRef ref = tref_ref(tr);
IRIns *ir = NULL; /* Silence compiler. */
lj_assertJ(tv < J->L->top, "slot %d above top of Lua stack", s);
if (!LJ_FR2 || ref || !(tr & (TREF_FRAME | TREF_CONT))) {
lj_assertJ(ref >= J->cur.nk && ref < J->cur.nins,
"slot %d ref %04d out of range", s, ref - REF_BIAS);
Expand Down Expand Up @@ -2476,6 +2477,7 @@ void lj_record_ins(jit_State *J)

case BC_TSETM:
rec_tsetm(J, ra, (BCReg)(J->L->top - J->L->base), (int32_t)rcv->u32.lo);
J->maxslot = ra; /* The table slot at ra-1 is the highest used slot. */
break;

case BC_TNEW:
Expand Down

0 comments on commit 0cc5fdf

Please sign in to comment.