]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Pdf: Add more sanity checks
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 6 Jul 2020 19:25:35 +0000 (20:25 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 6 Jul 2020 19:25:35 +0000 (20:25 +0100)
lualib/lua_content/pdf.lua

index 8a1e16ad0e7a83f8b497fd94835bd42fd59fc9bd..7b940ff0d04c57d0cf4077b99154248bc573b573 100644 (file)
@@ -460,7 +460,12 @@ local function parse_object_grammar(obj, task, pdf)
 
     if ret then
       if obj.stream then
-        obj.dict = obj_or_err
+        if type(obj_or_err) == 'table' then
+          obj.dict = obj_or_err
+        else
+          obj.dict = {}
+        end
+
         lua_util.debugm(N, task, 'stream object %s:%s is parsed to: %s',
             obj.major, obj.minor, obj_or_err)
       else