]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Lua_pdf: Check sanity
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 25 Jan 2020 16:46:04 +0000 (16:46 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 25 Jan 2020 16:47:14 +0000 (16:47 +0000)
lualib/lua_content/pdf.lua

index 760f042c0bb06f86af99bcea2acbf6b2170e192a..9c09618c089d3d8aa0950aa2bc79f7453e8da22c 100644 (file)
@@ -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)