diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-05-24 14:13:13 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-05-24 14:13:13 +0100 |
commit | eb5fc65aca905ad38bab0dae85dba0f9a56d7766 (patch) | |
tree | 126bf68a7c23e471920f73951ad8cd2326237a5b /src/libstat/stat_process.c | |
parent | 8303b194152ffc02b5079b6bd08f1fecfd43f5d0 (diff) | |
download | rspamd-eb5fc65aca905ad38bab0dae85dba0f9a56d7766.tar.gz rspamd-eb5fc65aca905ad38bab0dae85dba0f9a56d7766.zip |
[Fix] Do not use lightuserdata for traceback
LuaJIT limits lightuserdata usage to 47 bits. On Arm64, this leads to
break of the C <-> Lua interoperability using this type.
This rework has changed traceback function behaviour from lightuserdata
opaque pointer (GString * in particular) to luaL_Buffer.
Issue: #2906
Diffstat (limited to 'src/libstat/stat_process.c')
-rw-r--r-- | src/libstat/stat_process.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index d097e12e0..901d62a2b 100644 --- a/src/libstat/stat_process.c +++ b/src/libstat/stat_process.c @@ -46,7 +46,6 @@ rspamd_stat_tokenize_parts_metadata (struct rspamd_stat_ctx *st_ctx, if (st_ctx->lua_stat_tokens_ref != -1) { gint err_idx, ret; - GString *tb; struct rspamd_task **ptask; lua_pushcfunction (L, &rspamd_lua_traceback); @@ -58,13 +57,8 @@ rspamd_stat_tokenize_parts_metadata (struct rspamd_stat_ctx *st_ctx, rspamd_lua_setclass (L, "rspamd{task}", -1); if ((ret = lua_pcall (L, 1, 1, err_idx)) != 0) { - tb = lua_touserdata (L, -1); msg_err_task ("call to stat_tokens lua " - "script failed (%d): %v", ret, tb); - - if (tb) { - g_string_free (tb, TRUE); - } + "script failed (%d): %s", ret, lua_tostring (L, -1)); } else { if (lua_type (L, -1) != LUA_TTABLE) { @@ -913,7 +907,6 @@ rspamd_stat_check_autolearn (struct rspamd_task *task) struct rspamd_metric_result *mres = NULL; struct rspamd_task **ptask; lua_State *L; - GString *tb; guint i; gint err_idx; gboolean ret = FALSE; @@ -1011,10 +1004,8 @@ rspamd_stat_check_autolearn (struct rspamd_task *task) rspamd_lua_setclass (L, "rspamd{task}", -1); if (lua_pcall (L, 1, 1, err_idx) != 0) { - tb = lua_touserdata (L, -1); msg_err_task ("call to autolearn script failed: " - "%v", tb); - g_string_free (tb, TRUE); + "%s", lua_tostring (L, -1)); } else { lua_ret = lua_tostring (L, -1); |