mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
BUG/MEDIUM: lua: bad memory access
We cannot perform garbage collection on unreferenced thread. This memory is now free and another Lua process can use it for other things. HAProxy is monothread, so this bug doesn't cause crash. This patch must be backported in 1.6 and 1.7
This commit is contained in:
parent
b13b20a19a
commit
7bd10d58d3
12
src/hlua.c
12
src/hlua.c
@ -901,16 +901,10 @@ void hlua_ctx_destroy(struct hlua *lua)
|
|||||||
* the garbage collection.
|
* the garbage collection.
|
||||||
*/
|
*/
|
||||||
if (lua->flags & HLUA_MUST_GC) {
|
if (lua->flags & HLUA_MUST_GC) {
|
||||||
if (!SET_SAFE_LJMP(lua->T))
|
if (!SET_SAFE_LJMP(gL.T))
|
||||||
return;
|
return;
|
||||||
lua_gc(lua->T, LUA_GCCOLLECT, 0);
|
lua_gc(gL.T, LUA_GCCOLLECT, 0);
|
||||||
RESET_SAFE_LJMP(lua->T);
|
RESET_SAFE_LJMP(gL.T);
|
||||||
if (lua_status(lua->T) != LUA_OK) {
|
|
||||||
if (!SET_SAFE_LJMP(gL.T))
|
|
||||||
return;
|
|
||||||
lua_gc(gL.T, LUA_GCCOLLECT, 0);
|
|
||||||
RESET_SAFE_LJMP(gL.T);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lua->T = NULL;
|
lua->T = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user