]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Fix minilua vararg stack handling.
authorMike Pall <mike>
Wed, 21 Jul 2021 10:14:09 +0000 (12:14 +0200)
committerMike Pall <mike>
Wed, 21 Jul 2021 10:14:09 +0000 (12:14 +0200)
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

index 79150286cfc3d29cb1d6c65858c2f36af0708a23..cfc7491d9b00aebd73fd32408455da52ba2b8cd2 100644 (file)
@@ -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;