]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Pdf: Add some sanity check
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 5 Jun 2020 19:16:15 +0000 (20:16 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 5 Jun 2020 19:16:15 +0000 (20:16 +0100)
lualib/lua_content/pdf.lua

index 5e1fa906190f5c7c8a4e3389c8385147f1830711..ed88a24bd4ac937a0a4c324045f6c51bbddb2b8b 100644 (file)
@@ -426,7 +426,7 @@ local function maybe_extract_object_stream(obj, pdf, task)
     return nil
   end
   local dict = obj.dict
-  if dict.Length then
+  if dict.Length and type(obj.stream) == 'table' then
     local len = math.min(obj.stream.len,
         tonumber(maybe_dereference_object(dict.Length, pdf, task)) or 0)
     local real_stream = obj.stream.data:span(1, len)