From a89cf52149a0790378ae21440406e6ea52780b58 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 28 Apr 2020 15:38:47 +0100 Subject: [Fix] Disable text detection heuristics for encrypted parts Issue: #3349 --- lualib/lua_magic/heuristics.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lualib') diff --git a/lualib/lua_magic/heuristics.lua b/lualib/lua_magic/heuristics.lua index d9d408170..8aeafae90 100644 --- a/lualib/lua_magic/heuristics.lua +++ b/lualib/lua_magic/heuristics.lua @@ -377,6 +377,19 @@ exports.text_part_heuristic = function(part, log_obj) return true end + local parent = part:get_parent() + + if parent then + local parent_type,parent_subtype = parent:get_type() + + if parent_type == 'multipart' and parent_subtype == 'encrypted' then + -- Skip text heuristics for encrypted parts + lua_util.debugm(N, log_obj, "text part check: parent is encrypted, not a text part") + + return false + end + end + local content = part:get_content() local clen = #content local is_text -- cgit v1.2.3