aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-01-16 16:25:11 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-01-16 16:25:11 -0300
commitf5e55be2a0ce64066c1b0554675633b92c91fafb (patch)
treeef50204da94f49c8f788aad5f94557ed873b1fb6 /ldo.c
parent9f0c0fe0de64bc41efea73a2da881ff0a1036a03 (diff)
downloadlua-f5e55be2a0ce64066c1b0554675633b92c91fafb.tar.gz
lua-f5e55be2a0ce64066c1b0554675633b92c91fafb.tar.bz2
lua-f5e55be2a0ce64066c1b0554675633b92c91fafb.zip
Bug: Missing error status in panic functionv5.4
'luaD_throw' may call 'luaE_resetthread', which returns an error code but clears 'L->status'; so, 'luaD_throw' should set that status again.
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ldo.c b/ldo.c
index ea052950..958b1b7d 100644
--- a/ldo.c
+++ b/ldo.c
@@ -120,6 +120,7 @@ l_noret luaD_throw (lua_State *L, int errcode) {
120 else { /* thread has no error handler */ 120 else { /* thread has no error handler */
121 global_State *g = G(L); 121 global_State *g = G(L);
122 errcode = luaE_resetthread(L, errcode); /* close all upvalues */ 122 errcode = luaE_resetthread(L, errcode); /* close all upvalues */
123 L->status = errcode;
123 if (g->mainthread->errorJmp) { /* main thread has a handler? */ 124 if (g->mainthread->errorJmp) { /* main thread has a handler? */
124 setobjs2s(L, g->mainthread->top.p++, L->top.p - 1); /* copy error obj. */ 125 setobjs2s(L, g->mainthread->top.p++, L->top.p - 1); /* copy error obj. */
125 luaD_throw(g->mainthread, errcode); /* re-throw in main thread */ 126 luaD_throw(g->mainthread, errcode); /* re-throw in main thread */