commit 2aaf02a: [Minor] Lua_magic: Use larger span to look for text patterns

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Dec 3 11:56:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-12-03 11:51:03 +0000
URL: https://github.com/rspamd/rspamd/commit/2aaf02a82cf2eebcccbeb470ec0a8d2f1999815a (HEAD -> master)

[Minor] Lua_magic: Use larger span to look for text patterns

---
 lualib/lua_magic/heuristics.lua | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lualib/lua_magic/heuristics.lua b/lualib/lua_magic/heuristics.lua
index a0efdf50f..d9a7702a4 100644
--- a/lualib/lua_magic/heuristics.lua
+++ b/lualib/lua_magic/heuristics.lua
@@ -408,7 +408,7 @@ exports.text_part_heuristic = function(part, log_obj, _)
 
     if is_text then
       -- Try patterns
-      local span_len = math.min(160, clen)
+      local span_len = math.min(4096, clen)
       local start_span = content:span(1, span_len)
       local matches = txt_trie:match(start_span)
       local res = {}
@@ -418,8 +418,8 @@ exports.text_part_heuristic = function(part, log_obj, _)
           local ext,weight = txt_patterns_indexes[n][1], txt_patterns_indexes[n][2][2]
           if ext then
             res[ext] = (res[ext] or 0) + weight * #positions
-            lua_util.debugm(N, log_obj, "found txt pattern for %s: %s, total: %s",
-                ext, weight * #positions, res[ext])
+            lua_util.debugm(N, log_obj, "found txt pattern for %s: %s, total: %s; %s/%s announced",
+                ext, weight * #positions, res[ext], mtype, msubtype)
           end
         end
 


More information about the Commits mailing list