Merge branch 'master' into v2.1

This commit is contained in:
Mike Pall 2025-01-13 16:22:22 +01:00
commit a4f56a459a
2 changed files with 5 additions and 1 deletions

View File

@ -146,6 +146,8 @@ LJLIB_CF(getfenv) LJLIB_REC(.)
cTValue *o = L->base; cTValue *o = L->base;
if (!(o < L->top && tvisfunc(o))) { if (!(o < L->top && tvisfunc(o))) {
int level = lj_lib_optint(L, 1, 1); int level = lj_lib_optint(L, 1, 1);
if (level < 0)
lj_err_arg(L, 1, LJ_ERR_INVLVL);
o = lj_debug_frame(L, level, &level); o = lj_debug_frame(L, level, &level);
if (o == NULL) if (o == NULL)
lj_err_arg(L, 1, LJ_ERR_INVLVL); lj_err_arg(L, 1, LJ_ERR_INVLVL);
@ -168,6 +170,8 @@ LJLIB_CF(setfenv)
setgcref(L->env, obj2gco(t)); setgcref(L->env, obj2gco(t));
return 0; return 0;
} }
if (level < 0)
lj_err_arg(L, 1, LJ_ERR_INVLVL);
o = lj_debug_frame(L, level, &level); o = lj_debug_frame(L, level, &level);
if (o == NULL) if (o == NULL)
lj_err_arg(L, 1, LJ_ERR_INVLVL); lj_err_arg(L, 1, LJ_ERR_INVLVL);

View File

@ -2007,7 +2007,7 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults)
J->maxslot = dst + (BCReg)nresults; J->maxslot = dst + (BCReg)nresults;
} }
} else if (select_detect(J)) { /* y = select(x, ...) */ } else if (select_detect(J)) { /* y = select(x, ...) */
TRef tridx = J->base[dst-1]; TRef tridx = getslot(J, dst-1);
TRef tr = TREF_NIL; TRef tr = TREF_NIL;
ptrdiff_t idx = lj_ffrecord_select_mode(J, tridx, &J->L->base[dst-1]); ptrdiff_t idx = lj_ffrecord_select_mode(J, tridx, &J->L->base[dst-1]);
if (idx < 0) goto nyivarg; if (idx < 0) goto nyivarg;