Fix LUA garbage collector (CVE-2024-46981) (#1513)
Reset GC state before closing the lua VM to prevent user data to be wrongly freed while still might be used on destructor callbacks. Created and publish by Redis in their OSS branch. Signed-off-by: Madelyn Olson <madelyneolson@gmail.com> Co-authored-by: YaacovHazan <yaacov.hazan@redis.com>
This commit is contained in:
parent
bc1680d7e6
commit
e04acb377e
@ -279,6 +279,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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user