mirror of
https://github.com/lua/lua
synced 2026-09-27 00:28:25 +03:00
Bug: 'lua_settop' may use an invalid pointer to stack
This commit is contained in:
parent
603b2c64ad
commit
196bb94d66
5 changed files with 34 additions and 12 deletions
5
lfunc.c
5
lfunc.c
|
|
@ -223,9 +223,9 @@ static void poptbclist (lua_State *L) {
|
|||
|
||||
/*
|
||||
** Close all upvalues and to-be-closed variables up to the given stack
|
||||
** level.
|
||||
** level. Return restored 'level'.
|
||||
*/
|
||||
void luaF_close (lua_State *L, StkId level, int status, int yy) {
|
||||
StkId luaF_close (lua_State *L, StkId level, int status, int yy) {
|
||||
ptrdiff_t levelrel = savestack(L, level);
|
||||
luaF_closeupval(L, level); /* first, close the upvalues */
|
||||
while (L->tbclist >= level) { /* traverse tbc's down to that level */
|
||||
|
|
@ -234,6 +234,7 @@ void luaF_close (lua_State *L, StkId level, int status, int yy) {
|
|||
prepcallclosemth(L, tbc, status, yy); /* close variable */
|
||||
level = restorestack(L, levelrel);
|
||||
}
|
||||
return level;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue