Add missing check for LJ_KEYINDEX in ITERN recording.

Reported by dragonorloong. Analyzed by vfprintf. #827
This commit is contained in:
Mike Pall
2022-04-02 21:24:18 +02:00
parent e2c312e0de
commit 1cdff194cf
6 changed files with 39 additions and 12 deletions

View File

@@ -675,7 +675,8 @@ static LoopEvent rec_itern(jit_State *J, BCReg ra, BCReg rb)
lj_snap_add(J); /* Required to make JLOOP the first ins in a side-trace. */
ix.tab = getslot(J, ra-2);
ix.key = J->base[ra-1] ? J->base[ra-1] :
sloadt(J, (int32_t)(ra-1), IRT_INT, IRSLOAD_KEYINDEX);
sloadt(J, (int32_t)(ra-1), IRT_GUARD|IRT_INT,
IRSLOAD_TYPECHECK|IRSLOAD_KEYINDEX);
copyTV(J->L, &ix.tabv, &J->L->base[ra-2]);
copyTV(J->L, &ix.keyv, &J->L->base[ra-1]);
ix.idxchain = (rb < 3); /* Omit value type check, if unused. */