aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-05-24 14:13:13 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-05-24 14:13:13 +0100
commiteb5fc65aca905ad38bab0dae85dba0f9a56d7766 (patch)
tree126bf68a7c23e471920f73951ad8cd2326237a5b /src/libmime
parent8303b194152ffc02b5079b6bd08f1fecfd43f5d0 (diff)
downloadrspamd-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/libmime')
-rw-r--r--src/libmime/message.c7
-rw-r--r--src/libmime/mime_expressions.c9
2 files changed, 4 insertions, 12 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c
index 6211ea2f3..cd3772c78 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -716,11 +716,8 @@ rspamd_message_process_plain_text_part (struct rspamd_task *task,
text_part->utf_raw_content->len);
if (lua_pcall (L, 1, 1, err_idx) != 0) {
- GString *tb;
-
- tb = lua_touserdata (L, -1);
- msg_err_task ("cannot call lua lua_ical.ical_txt_values: %s", tb->str);
- g_string_free (tb, TRUE);
+ msg_err_task ("cannot call lua lua_ical.ical_txt_values: %s",
+ lua_tostring (L, -1));
lua_settop (L, err_idx - 1);
return FALSE;
diff --git a/src/libmime/mime_expressions.c b/src/libmime/mime_expressions.c
index 4a0071f28..7a0c27f1b 100644
--- a/src/libmime/mime_expressions.c
+++ b/src/libmime/mime_expressions.c
@@ -1114,7 +1114,6 @@ rspamd_mime_expr_process (void *ud, rspamd_expression_atom_t *atom)
}
else if (mime_atom->type == MIME_ATOM_LOCAL_LUA_FUNCTION) {
gint err_idx;
- GString *tb;
L = task->cfg->lua_state;
lua_pushcfunction (L, &rspamd_lua_traceback);
@@ -1124,13 +1123,9 @@ rspamd_mime_expr_process (void *ud, rspamd_expression_atom_t *atom)
rspamd_lua_task_push (L, task);
if (lua_pcall (L, 1, 1, err_idx) != 0) {
- tb = lua_touserdata (L, -1);
- msg_info_task ("lua call to local function for atom '%s' failed: %v",
+ msg_info_task ("lua call to local function for atom '%s' failed: %s",
mime_atom->str,
- tb);
- if (tb) {
- g_string_free (tb, TRUE);
- }
+ lua_tostring (L, -1));
}
else {
if (lua_type (L, -1) == LUA_TBOOLEAN) {