]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Pdf: Support some weird objects with no newline before endobj
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 10 May 2020 18:33:37 +0000 (19:33 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 10 May 2020 18:33:37 +0000 (19:33 +0100)
lualib/lua_content/pdf.lua

index 92b17053482dd7255e1b8757ba1c6492a7c68e43..0e3f024aeb87a8653ec98798dad99b4c7a5f1397 100644 (file)
@@ -459,6 +459,8 @@ local function parse_object_grammar(obj, task, pdf)
               obj.major, obj.minor, obj_or_err)
           pdf.ref[obj_ref(obj.major, obj.minor)] = obj
         else
+          lua_util.debugm(N, task, 'direct object %s:%s is parsed to raw data: %s',
+              obj.major, obj.minor, obj_or_err)
           pdf.ref[obj_ref(obj.major, obj.minor)] = obj_or_err
           obj.dict = {}
           obj.uncompressed = obj_or_err
@@ -841,8 +843,8 @@ local function extract_outer_objects(task, input, pdf)
     local last = pdf.end_objects[end_pos]
 
     -- 7 is length of `endobj\n`
-    if first + 7 < last then
-      local len = last - first - 7
+    if first + 6 < last then
+      local len = last - first - 6
 
       -- Also get the starting span and try to match it versus obj re to get numbers
       local obj_line_potential = first - 32