From: Vsevolod Stakhov Date: Sat, 18 Jan 2020 09:45:20 +0000 (+0000) Subject: [Minor] Check type of resources X-Git-Tag: 2.3~83 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b588019c9bc2b6b359ff40197dc5d9da3f2c9de1;p=rspamd.git [Minor] Check type of resources --- 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 = {}