From 36b339bbcfdcb82a02bfa78c2ec7d585d1d342e0 Mon Sep 17 00:00:00 2001 From: norrath-hero-cn <73905273+norrath-hero-cn@users.noreply.github.com> Date: Sun, 6 Aug 2023 01:38:32 +0800 Subject: [PATCH] Prevent early destruction of gFuns, fixes AddressSanitizer: heap-use-after-free (#22386) Prevent destruction of gFuns before callClosures (cherry picked from commit e0396900ed74eb821641d026a68415199fc4a257) --- lib/std/exitprocs.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/exitprocs.nim b/lib/std/exitprocs.nim index c44eb30d65..e42397c4cf 100644 --- a/lib/std/exitprocs.nim +++ b/lib/std/exitprocs.nim @@ -22,7 +22,7 @@ type var gFunsLock: Lock - gFuns: seq[Fun] + gFuns {.cursor.}: seq[Fun] #Intentionally use the cursor to break up the lifetime trace and make it compatible with JS. initLock(gFunsLock)