aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_content
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-01-25 16:46:04 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-01-25 16:47:14 +0000
commit6135bc06fe43b7524f01d45f134f1a85cd4aa3f9 (patch)
tree8887b8fcde0940a42894eea4e9f525212e5a6656 /lualib/lua_content
parent01dd389504620aaea909f2c8f2ec8e753e657bd8 (diff)
downloadrspamd-6135bc06fe43b7524f01d45f134f1a85cd4aa3f9.tar.gz
rspamd-6135bc06fe43b7524f01d45f134f1a85cd4aa3f9.zip
[Minor] Lua_pdf: Check sanity
Diffstat (limited to 'lualib/lua_content')
-rw-r--r--lualib/lua_content/pdf.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/lualib/lua_content/pdf.lua b/lualib/lua_content/pdf.lua
index 760f042c0..9c09618c0 100644
--- a/lualib/lua_content/pdf.lua
+++ b/lualib/lua_content/pdf.lua
@@ -829,9 +829,9 @@ local function extract_outer_objects(task, input, pdf)
-- Also get the starting span and try to match it versus obj re to get numbers
local obj_line_potential = first - 32
if obj_line_potential < 1 then obj_line_potential = 1 end
-
- if end_pos > 1 and pdf.end_objects[end_pos - 1] >= obj_line_potential then
- obj_line_potential = pdf.end_objects[end_pos - 1] + 1
+ local prev_obj_end = pdf.end_objects[end_pos - 1]
+ if end_pos > 1 and prev_obj_end >= obj_line_potential and prev_obj_end < first then
+ obj_line_potential = prev_obj_end + 1
end
local obj_line_span = input:span(obj_line_potential, first - obj_line_potential + 1)