From fbb36bb6bfa88716a47c58bcf9ce9f2ef752abac Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Fri, 27 Mar 2026 20:04:50 +0100 Subject: Fix VM event error handling for finalizers. Reported by Sergey Kaplun. #1445 --- src/lj_gc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lj_gc.c b/src/lj_gc.c index 08972dc5..1fed0b54 100644 --- a/src/lj_gc.c +++ b/src/lj_gc.c @@ -525,10 +525,12 @@ static void gc_call_finalizer(global_State *g, lua_State *L, if (LJ_HASPROFILE && (oldh & HOOK_PROFILE)) lj_dispatch_update(g); g->gc.threshold = oldt; /* Restore GC threshold. */ if (errcode) { + TValue tmp; + copyTV(VL, &tmp, VL->top-1); + VL->top--; lj_vmevent_send(g, ERRFIN, - copyTV(V, V->top++, L->top-1); + copyTV(V, V->top++, &tmp); ); - L->top--; } } -- cgit v1.2.3-55-g6feb