]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Use rspamd_text for subprocess callback data to avoid large allocations
authorVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 20 Jan 2026 16:13:21 +0000 (16:13 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 20 Jan 2026 16:13:21 +0000 (16:13 +0000)
Replace lua_pushlstring with lua_new_text(FALSE) when passing subprocess
result data to Lua callbacks. This avoids copying potentially large buffers
(e.g., 2.7MB neural network training results) into Lua's heap, which could
cause crashes under memory pressure.

src/lua/lua_worker.c

index bfe81755024080af849f2eeddc99abed735b9fa6..5831d172ef2f64ac28ff35a2a4f5687763da6073 100644 (file)
@@ -569,7 +569,7 @@ rspamd_lua_call_on_complete(lua_State *L,
        }
 
        if (data) {
-               lua_pushlstring(L, data, datalen);
+               lua_new_text(L, data, datalen, FALSE);
        }
        else {
                lua_pushnil(L);