25 lines
719 B
Diff
25 lines
719 B
Diff
From e344b2b5879aa52870e6838212dfb78b7968fcbf Mon Sep 17 00:00:00 2001
|
|
From: YaacovHazan <yaacov.hazan@redis.com>
|
|
Date: Sun, 15 Dec 2024 21:33:11 +0200
|
|
Subject: [PATCH] Fix LUA garbage collector (CVE-2024-46981)
|
|
|
|
Reset GC state before closing the lua VM to prevent user data
|
|
to be wrongly freed while still might be used on destructor callbacks.
|
|
---
|
|
src/eval.c | 1 +
|
|
1 file changed, 1 insertion(+)
|
|
|
|
diff --git a/src/eval.c b/src/eval.c
|
|
index eb4b529368d..47c66b67c6d 100644
|
|
--- a/src/eval.c
|
|
+++ b/src/eval.c
|
|
@@ -272,6 +272,7 @@ void scriptingRelease(int async) {
|
|
else
|
|
dictRelease(lctx.lua_scripts);
|
|
lctx.lua_scripts_mem = 0;
|
|
+ lua_gc(lctx.lua, LUA_GCCOLLECT, 0);
|
|
lua_close(lctx.lua);
|
|
}
|
|
|
|
|