]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add some sanity checks
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 5 Mar 2020 11:49:20 +0000 (11:49 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 5 Mar 2020 11:49:32 +0000 (11:49 +0000)
lualib/lua_content/pdf.lua

index 9c09618c089d3d8aa0950aa2bc79f7453e8da22c..c69c9e3d242089e34a19213f8bd07bb0c61f11c6 100644 (file)
@@ -639,7 +639,7 @@ process_dict = function(task, pdf, obj, dict)
 
       for _,c in ipairs(contents) do
         local cobj = maybe_dereference_object(c, pdf, task)
-        if cobj then
+        if cobj and type(cobj) == 'table' then
           obj.contents[#obj.contents + 1] = cobj
           cobj.parent = obj
           cobj.type = 'content'
@@ -766,7 +766,7 @@ local function pdf_compound_object_unpack(_, uncompressed, pdf, task, first)
           span_len = (elts[i + 1][2] + first) - offset
         end
 
-        if span_len > 0 then
+        if span_len > 0 and offset + span_len < #uncompressed then
           local obj = {
             major = obj_number,
             minor = 0, -- Implicit