Vsevolod Stakhov
5 months ago
No known key found for this signature in database
GPG Key ID: 7647B6790081437
2 changed files with
10 additions and
10 deletions
-
src/libstat/stat_process.c
-
src/lua/lua_parsers.c
|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
* Copyright 2024 Vsevolod Stakhov |
|
|
|
* Copyright 2025 Vsevolod Stakhov |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -108,12 +108,12 @@ rspamd_stat_tokenize_parts_metadata(struct rspamd_stat_ctx *st_ctx, |
|
|
|
"M", |
|
|
|
task->tokens); |
|
|
|
} |
|
|
|
goto meta_words_done; |
|
|
|
|
|
|
|
return; |
|
|
|
meta_words_error: |
|
|
|
/* On error, just continue without the problematic tokens */ |
|
|
|
meta_words_done: |
|
|
|
/* kvec memory will be freed with task pool */ |
|
|
|
|
|
|
|
msg_err("cannot process meta words for task" |
|
|
|
"memory allocation error, skipping the remaining"); |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
@ -108,8 +108,8 @@ int lua_parsers_tokenize_text(lua_State *L) |
|
|
|
struct rspamd_lua_text *t; |
|
|
|
struct rspamd_process_exception *ex; |
|
|
|
UText utxt = UTEXT_INITIALIZER; |
|
|
|
GArray *res; |
|
|
|
rspamd_stat_token_t *w; |
|
|
|
rspamd_words_t *res; |
|
|
|
rspamd_word_t *w; |
|
|
|
|
|
|
|
if (lua_type(L, 1) == LUA_TSTRING) { |
|
|
|
in = luaL_checklstring(L, 1, &len); |
|
|
|
@ -175,10 +175,10 @@ int lua_parsers_tokenize_text(lua_State *L) |
|
|
|
lua_pushnil(L); |
|
|
|
} |
|
|
|
else { |
|
|
|
lua_createtable(L, res->len, 0); |
|
|
|
lua_createtable(L, kv_size(*res), 0); |
|
|
|
|
|
|
|
for (i = 0; i < res->len; i++) { |
|
|
|
w = &g_array_index(res, rspamd_stat_token_t, i); |
|
|
|
for (i = 0; i < kv_size(*res); i++) { |
|
|
|
w = &kv_A(*res, i); |
|
|
|
lua_pushlstring(L, w->original.begin, w->original.len); |
|
|
|
lua_rawseti(L, -2, i + 1); |
|
|
|
} |
|
|
|
|