aboutsummaryrefslogtreecommitdiff
path: root/lcorolib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-10-25 16:44:06 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-10-25 16:44:06 -0300
commit1e64c1391f9a14115b5cc82066dbf545ae73ee27 (patch)
tree4aa3b6c2854c920ed825bf9fe46d275826e5ab6e /lcorolib.c
parentb85816b9a884cbe4cfd139a8e11ffc28ecead576 (diff)
downloadlua-1e64c1391f9a14115b5cc82066dbf545ae73ee27.tar.gz
lua-1e64c1391f9a14115b5cc82066dbf545ae73ee27.tar.bz2
lua-1e64c1391f9a14115b5cc82066dbf545ae73ee27.zip
Bug: stack overflow with nesting of coroutine.close
Diffstat (limited to 'lcorolib.c')
-rw-r--r--lcorolib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lcorolib.c b/lcorolib.c
index 785a1e81..40b880b1 100644
--- a/lcorolib.c
+++ b/lcorolib.c
@@ -76,7 +76,7 @@ static int luaB_auxwrap (lua_State *L) {
76 if (l_unlikely(r < 0)) { /* error? */ 76 if (l_unlikely(r < 0)) { /* error? */
77 int stat = lua_status(co); 77 int stat = lua_status(co);
78 if (stat != LUA_OK && stat != LUA_YIELD) { /* error in the coroutine? */ 78 if (stat != LUA_OK && stat != LUA_YIELD) { /* error in the coroutine? */
79 stat = lua_resetthread(co); /* close its tbc variables */ 79 stat = lua_resetthread(co, L); /* close its tbc variables */
80 lua_assert(stat != LUA_OK); 80 lua_assert(stat != LUA_OK);
81 lua_xmove(co, L, 1); /* move error message to the caller */ 81 lua_xmove(co, L, 1); /* move error message to the caller */
82 } 82 }
@@ -172,7 +172,7 @@ static int luaB_close (lua_State *L) {
172 int status = auxstatus(L, co); 172 int status = auxstatus(L, co);
173 switch (status) { 173 switch (status) {
174 case COS_DEAD: case COS_YIELD: { 174 case COS_DEAD: case COS_YIELD: {
175 status = lua_resetthread(co); 175 status = lua_resetthread(co, L);
176 if (status == LUA_OK) { 176 if (status == LUA_OK) {
177 lua_pushboolean(L, 1); 177 lua_pushboolean(L, 1);
178 return 1; 178 return 1;