LJ_FR2: Fix stack checks in vararg calls.

Thanks to Peter Cawley. #1048
This commit is contained in:
Mike Pall
2023-09-21 05:19:55 +02:00
parent 234dbc481e
commit d1a2fef8a8
4 changed files with 4 additions and 2 deletions

View File

@@ -453,7 +453,7 @@ static int call_init(lua_State *L, GCfunc *fn)
int numparams = pt->numparams;
int gotparams = (int)(L->top - L->base);
int need = pt->framesize;
if ((pt->flags & PROTO_VARARG)) need += 1+gotparams;
if ((pt->flags & PROTO_VARARG)) need += 1+LJ_FR2+gotparams;
lj_state_checkstack(L, (MSize)need);
numparams -= gotparams;
return numparams >= 0 ? numparams : 0;