fixing 'lua_status' in panic.

'luaD_throw' may call 'luaE_resetthread', which returns an error code
but clears 'L->status'; so, 'luaD_throw' should set that status again.
This commit is contained in:
Roberto Ierusalimschy
2025-01-16 16:07:39 -03:00
parent 2d8d5c74b5
commit 664bda02ba
3 changed files with 28 additions and 2 deletions

1
ldo.c
View File

@@ -133,6 +133,7 @@ l_noret luaD_throw (lua_State *L, int errcode) {
else { /* thread has no error handler */
global_State *g = G(L);
errcode = luaE_resetthread(L, errcode); /* close all upvalues */
L->status = cast_byte(errcode);
if (g->mainthread->errorJmp) { /* main thread has a handler? */
setobjs2s(L, g->mainthread->top.p++, L->top.p - 1); /* copy error obj. */
luaD_throw(g->mainthread, errcode); /* re-throw in main thread */