commit b588019: [Minor] Check type of resources
Vsevolod Stakhov
vsevolod at highsecure.ru
Sat Jan 18 21:28:15 UTC 2020
Author: Vsevolod Stakhov
Date: 2020-01-18 09:45:20 +0000
URL: https://github.com/rspamd/rspamd/commit/b588019c9bc2b6b359ff40197dc5d9da3f2c9de1
[Minor] Check type of resources
---
lualib/lua_content/pdf.lua | 7 +++++++
1 file changed, 7 insertions(+)
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 = {}
More information about the Commits
mailing list