From 1e64c1391f9a14115b5cc82066dbf545ae73ee27 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 25 Oct 2022 16:44:06 -0300 Subject: Bug: stack overflow with nesting of coroutine.close --- lcorolib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lcorolib.c') 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) { if (l_unlikely(r < 0)) { /* error? */ int stat = lua_status(co); if (stat != LUA_OK && stat != LUA_YIELD) { /* error in the coroutine? */ - stat = lua_resetthread(co); /* close its tbc variables */ + stat = lua_resetthread(co, L); /* close its tbc variables */ lua_assert(stat != LUA_OK); lua_xmove(co, L, 1); /* move error message to the caller */ } @@ -172,7 +172,7 @@ static int luaB_close (lua_State *L) { int status = auxstatus(L, co); switch (status) { case COS_DEAD: case COS_YIELD: { - status = lua_resetthread(co); + status = lua_resetthread(co, L); if (status == LUA_OK) { lua_pushboolean(L, 1); return 1; -- cgit v1.2.3-55-g6feb