diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-05-25 17:41:39 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-05-25 17:41:39 -0300 |
commit | 196bb94d66e727e0aec053a0276c3ad701500762 (patch) | |
tree | a7639f32207179b5bd5e1ce04dd35972e1b2e148 /lfunc.c | |
parent | 603b2c64add5fbf4b7343525cf109af0c7077695 (diff) | |
download | lua-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.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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 | */ |
228 | void luaF_close (lua_State *L, StkId level, int status, int yy) { | 228 | StkId 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 | ||