aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_content
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-05-27 16:06:57 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-05-27 16:06:57 +0100
commitb1e451f0e19a5ca56498a1458532ffb31296615d (patch)
tree90ae32d84668dcf42b9b9a5e6d373b1fc68f309a /lualib/lua_content
parentdab0284b43b12159f8adc70b70255aad9e6df85d (diff)
downloadrspamd-b1e451f0e19a5ca56498a1458532ffb31296615d.tar.gz
rspamd-b1e451f0e19a5ca56498a1458532ffb31296615d.zip
[Minor] Do not try to unpack streams with Predictor attribute
Diffstat (limited to 'lualib/lua_content')
-rw-r--r--lualib/lua_content/pdf.lua20
1 files changed, 15 insertions, 5 deletions
diff --git a/lualib/lua_content/pdf.lua b/lualib/lua_content/pdf.lua
index 57968013f..785959dfe 100644
--- a/lualib/lua_content/pdf.lua
+++ b/lualib/lua_content/pdf.lua
@@ -391,7 +391,7 @@ local function apply_pdf_filter(input, filt)
end
-- Conditionally apply a pipeline of stream filters and return uncompressed data
-local function maybe_apply_filter(dict, data)
+local function maybe_apply_filter(dict, data, pdf, task)
local uncompressed = data
if dict.Filter then
@@ -400,6 +400,16 @@ local function maybe_apply_filter(dict, data)
filt = {filt}
end
+ if dict.DecodeParms then
+ local decode_params = maybe_dereference_object(dict.DecodeParms, pdf, task)
+
+ if type(decode_params) == 'table' then
+ if decode_params.Predictor then
+ return nil,'predictor exists'
+ end
+ end
+ end
+
for _,f in ipairs(filt) do
uncompressed = apply_pdf_filter(uncompressed, f)
@@ -407,7 +417,7 @@ local function maybe_apply_filter(dict, data)
end
end
- return uncompressed
+ return uncompressed,nil
end
-- Conditionally extract stream data from object and attach it as obj.uncompressed
@@ -422,7 +432,7 @@ local function maybe_extract_object_stream(obj, pdf, task)
tonumber(maybe_dereference_object(dict.Length, pdf, task)) or 0)
local real_stream = obj.stream.data:span(1, len)
- local uncompressed = maybe_apply_filter(dict, real_stream)
+ local uncompressed,filter_err = maybe_apply_filter(dict, real_stream, pdf, task)
if uncompressed then
obj.uncompressed = uncompressed
@@ -430,8 +440,8 @@ local function maybe_extract_object_stream(obj, pdf, task)
obj.major, obj.minor, len, uncompressed:len())
return obj.uncompressed
else
- lua_util.debugm(N, task, 'cannot extract object %s:%s; len = %s; filter = %s',
- obj.major, obj.minor, len, dict.Filter)
+ lua_util.debugm(N, task, 'cannot extract object %s:%s; len = %s; filter = %s: %s',
+ obj.major, obj.minor, len, dict.Filter, filter_err)
end
end
end