From: Vsevolod Stakhov Date: Tue, 20 Jan 2026 16:13:21 +0000 (+0000) Subject: [Fix] Use rspamd_text for subprocess callback data to avoid large allocations X-Git-Tag: 4.0.0~179^2~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=56ba2baed212e08559e772bf4dcf9d13d2028a38;p=thirdparty%2Frspamd.git [Fix] Use rspamd_text for subprocess callback data to avoid large allocations 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. --- diff --git a/src/lua/lua_worker.c b/src/lua/lua_worker.c index bfe8175502..5831d172ef 100644 --- a/src/lua/lua_worker.c +++ b/src/lua/lua_worker.c @@ -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);