From 81a797373fa5364f7640b7f1668abada56a45d6b Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Wed, 21 Jul 2021 12:14:09 +0200 Subject: [PATCH] Fix minilua vararg stack handling. Note: this is not exploitable! minilua is only used during the LuaJIT build process. It only runs controlled and static Lua code (DynASM), which is entirely contained within this repo. LuaJIT itself has completely different stack handling code and is not affected either. This change is solely for the benefit of others, who might possibly use minilua for purposes other than running DynASM. --- src/host/minilua.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/host/minilua.c b/src/host/minilua.c index 79150286..cfc7491d 100644 --- a/src/host/minilua.c +++ b/src/host/minilua.c @@ -1134,7 +1134,7 @@ if(!cl->isC){ CallInfo*ci; StkId st,base; Proto*p=cl->p; -luaD_checkstack(L,p->maxstacksize); +luaD_checkstack(L,p->maxstacksize+p->numparams); func=restorestack(L,funcr); if(!p->is_vararg){ base=func+1;