Fixed some bugs around stack reallocation

Long time without using HARDSTACKTESTS...
This commit is contained in:
Roberto Ierusalimschy
2021-02-05 11:00:28 -03:00
parent e500892e18
commit 2bfa13e520
4 changed files with 6 additions and 1 deletions

2
ldo.c
View File

@@ -412,12 +412,12 @@ static void moveresults (lua_State *L, StkId res, int nres, int wanted) {
if (hastocloseCfunc(wanted)) { /* to-be-closed variables? */
ptrdiff_t savedres = savestack(L, res);
luaF_close(L, res, CLOSEKTOP, 0); /* may change the stack */
res = restorestack(L, savedres);
wanted = codeNresults(wanted); /* correct value */
if (wanted == LUA_MULTRET)
wanted = nres;
if (L->hookmask) /* if needed, call hook after '__close's */
rethook(L, L->ci, nres);
res = restorestack(L, savedres); /* close and hook can move stack */
}
break;
}