aboutsummaryrefslogtreecommitdiff
path: root/lfunc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-05-25 17:41:39 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-05-25 17:41:39 -0300
commit196bb94d66e727e0aec053a0276c3ad701500762 (patch)
treea7639f32207179b5bd5e1ce04dd35972e1b2e148 /lfunc.c
parent603b2c64add5fbf4b7343525cf109af0c7077695 (diff)
downloadlua-196bb94d66e727e0aec053a0276c3ad701500762.tar.gz
lua-196bb94d66e727e0aec053a0276c3ad701500762.tar.bz2
lua-196bb94d66e727e0aec053a0276c3ad701500762.zip
Bug: 'lua_settop' may use an invalid pointer to stack
Diffstat (limited to 'lfunc.c')
-rw-r--r--lfunc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lfunc.c b/lfunc.c
index f5889a21..3ed65de2 100644
--- a/lfunc.c
+++ b/lfunc.c
@@ -223,9 +223,9 @@ static void poptbclist (lua_State *L) {
223 223
224/* 224/*
225** Close all upvalues and to-be-closed variables up to the given stack 225** Close all upvalues and to-be-closed variables up to the given stack
226** level. 226** level. Return restored 'level'.
227*/ 227*/
228void luaF_close (lua_State *L, StkId level, int status, int yy) { 228StkId luaF_close (lua_State *L, StkId level, int status, int yy) {
229 ptrdiff_t levelrel = savestack(L, level); 229 ptrdiff_t levelrel = savestack(L, level);
230 luaF_closeupval(L, level); /* first, close the upvalues */ 230 luaF_closeupval(L, level); /* first, close the upvalues */
231 while (L->tbclist >= level) { /* traverse tbc's down to that level */ 231 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) {
234 prepcallclosemth(L, tbc, status, yy); /* close variable */ 234 prepcallclosemth(L, tbc, status, yy); /* close variable */
235 level = restorestack(L, levelrel); 235 level = restorestack(L, levelrel);
236 } 236 }
237 return level;
237} 238}
238 239
239 240