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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user