diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-01-18 09:45:20 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-01-18 09:45:20 +0000 |
commit | b588019c9bc2b6b359ff40197dc5d9da3f2c9de1 (patch) | |
tree | db78d1a7f4d8f20f1219ee3356cca05227fee477 /lualib | |
parent | fcf7825b5891f9bd6b3bbfea364c7f0717b54938 (diff) | |
download | rspamd-b588019c9bc2b6b359ff40197dc5d9da3f2c9de1.tar.gz rspamd-b588019c9bc2b6b359ff40197dc5d9da3f2c9de1.zip |
[Minor] Check type of resources
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/lua_content/pdf.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lualib/lua_content/pdf.lua b/lualib/lua_content/pdf.lua index 460938f8a..9b6ee2622 100644 --- a/lualib/lua_content/pdf.lua +++ b/lualib/lua_content/pdf.lua @@ -23,6 +23,7 @@ local rspamd_trie = require "rspamd_trie" local rspamd_util = require "rspamd_util" local rspamd_text = require "rspamd_text" local rspamd_url = require "rspamd_url" +local rspamd_logger = require "rspamd_logger" local bit = require "bit" local N = "lua_content" local lua_util = require "lua_util" @@ -524,6 +525,12 @@ local function process_dict(task, pdf, obj, dict) local resources = dict.Resources if resources and type(resources) == 'table' then obj.resources = maybe_dereference_object(resources, pdf, task) + + if type(obj.resources) ~= 'table' then + rspamd_logger.infox(task, 'cannot parse resources from pdf: %s returned by grammar', + obj.resources) + obj.resources = {} + end else -- Fucking pdf: we need to inherit from parent resources = {} |