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.
This commit is contained in:
YaacovHazan
2025-01-06 16:03:47 +02:00
committed by YaacovHazan
parent 15e212bf69
commit e344b2b587
+1
View File
@@ -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);
}