]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Lua_content: Fix hang
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 13 Jan 2020 17:05:07 +0000 (17:05 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 13 Jan 2020 17:05:07 +0000 (17:05 +0000)
lualib/lua_content/pdf.lua

index 741c011bdf2239035bb9b8b08bccff7b4bc2ef02..516eb8be250a0c8abc9a381f1625ed73b82255b5 100644 (file)
@@ -54,7 +54,7 @@ local pdf_patterns = {
   },
   start_object = {
     patterns = {
-      [=[[\r\n]\s*\d+ \d+ obj[\r\n]]=]
+      [=[[\r\n\0]\s*\d+ \d+ obj[\r\n]]=]
     }
   },
   end_object = {
@@ -517,7 +517,10 @@ local function postprocess_pdf_objects(task, input, pdf)
       obj_count = obj_count + 1
       start_pos = start_pos + 1
       end_pos = end_pos + 1
-    elseif start_pos > end_pos then
+    elseif first > last then
+      end_pos = end_pos + 1
+    else
+      start_pos = start_pos + 1
       end_pos = end_pos + 1
     end
   end