From 664bda02ba4bd167728a2acbe658cc4a9dd9b0b5 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 16 Jan 2025 16:07:39 -0300 Subject: 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. --- ldo.c | 1 + 1 file changed, 1 insertion(+) (limited to 'ldo.c') diff --git a/ldo.c b/ldo.c index fb9df5d3..994ad6f0 100644 --- a/ldo.c +++ b/ldo.c @@ -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 */ -- cgit v1.2.3-55-g6feb