aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-12-01 14:37:44 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-12-01 14:37:44 +0000
commit0007aabece04ca4b86447a6abd259f4cef70731e (patch)
tree18982dccf63ba01d8f91df36499fb696aafda7d1 /lualib
parent42678000b60db1e431685455c99ec82bf734a05f (diff)
downloadrspamd-0007aabece04ca4b86447a6abd259f4cef70731e.tar.gz
rspamd-0007aabece04ca4b86447a6abd259f4cef70731e.zip
[Minor] Lua_content: Fix a corner case when unpacking compound objects
Diffstat (limited to 'lualib')
-rw-r--r--lualib/lua_content/pdf.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/lualib/lua_content/pdf.lua b/lualib/lua_content/pdf.lua
index 11d5cab46..4e199b8b6 100644
--- a/lualib/lua_content/pdf.lua
+++ b/lualib/lua_content/pdf.lua
@@ -811,7 +811,7 @@ local function pdf_compound_object_unpack(_, uncompressed, pdf, task, first)
span_len = (elts[i + 1][2] + first) - offset
end
- if span_len > 0 and offset + span_len < #uncompressed then
+ if span_len > 0 and offset + span_len <= #uncompressed then
local obj = {
major = obj_number,
minor = 0, -- Implicit
@@ -823,6 +823,9 @@ local function pdf_compound_object_unpack(_, uncompressed, pdf, task, first)
if obj.dict then
pdf.objects[#pdf.objects + 1] = obj
end
+ else
+ lua_util.debugm(N, task, 'invalid span_len for compound object %s:%s; offset = %s, len = %s',
+ pair[1], pair[2], offset + span_len, #uncompressed)
end
end
end