mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-04-22 06:43:27 +00:00
Fix cur_L restoration on error throw
When an error is thrown on the coroutine that is not the one being currently executed, cur_L is not set up. Hence, when the running trace exits at assertion guard right after the error is caught, Lua state is restored from the incorrect cur_L. As a result the resulting stack is inconsistent and the crash occurs. This patch updates the cur_L within lj_err_throw() to the given lua_State, where the error is raised, since this is the only coroutine that can proceed later.
This commit is contained in:
parent
983d66b8c5
commit
90df93a45f
@ -735,6 +735,8 @@ LJ_NOINLINE void LJ_FASTCALL lj_err_throw(lua_State *L, int errcode)
|
||||
{
|
||||
global_State *g = G(L);
|
||||
lj_trace_abort(g);
|
||||
/* Set the running lua_State as the one where the error can be handled. */
|
||||
setgcref(g->cur_L, obj2gco(L));
|
||||
L->status = LUA_OK;
|
||||
#if LJ_UNWIND_EXT
|
||||
err_raise_ext(g, errcode);
|
||||
|
Loading…
Reference in New Issue
Block a user