commit 1a5d3a2: [Minor] Pdf: Add some sanity check

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Jun 5 19:21:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-06-05 20:16:15 +0100
URL: https://github.com/rspamd/rspamd/commit/1a5d3a27d7fffd575816d6efa6965c5702bf4171 (HEAD -> master)

[Minor] Pdf: Add some sanity check

---
 lualib/lua_content/pdf.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lualib/lua_content/pdf.lua b/lualib/lua_content/pdf.lua
index 5e1fa9061..ed88a24bd 100644
--- a/lualib/lua_content/pdf.lua
+++ b/lualib/lua_content/pdf.lua
@@ -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)


More information about the Commits mailing list