summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-07-13 16:35:32 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-07-13 16:35:32 -0300
commite37b96db04b373f79661357e18a061186ceb8e5e (patch)
tree6450f79af6800e7b13098e70967a4ae5b98840cd
parentb202669d761660f7d8131bef507e5c48df1ffba7 (diff)
downloadlua-github-v5.4.0-patch.tar.gz
Bug fix: Errors in finalizers need a valid 'pc'v5.4.0-patch
Errors in finalizers need a valid 'pc' to produce an error message, even if the error is not propagated. Therefore, calls to the GC (which may call finalizers) inside luaV_execute must save the 'pc'.
-rw-r--r--lvm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lvm.c b/lvm.c
index e7781dbf..a2692c2c 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1104,7 +1104,7 @@ void luaV_finishOp (lua_State *L) {
#define checkGC(L,c) \
- { luaC_condGC(L, L->top = (c), /* limit of live values */ \
+ { luaC_condGC(L, (savepc(L), L->top = (c)), \
updatetrap(ci)); \
luai_threadyield(L); }
@@ -1792,8 +1792,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
vmbreak;
}
vmcase(OP_VARARGPREP) {
- luaT_adjustvarargs(L, GETARG_A(i), ci, cl->p);
- updatetrap(ci);
+ ProtectNT(luaT_adjustvarargs(L, GETARG_A(i), ci, cl->p));
if (trap) {
luaD_hookcall(L, ci);
L->oldpc = pc + 1; /* next opcode will be seen as a "new" line */