76f8c5
From 68ef84e5968a4249c2162b839ca6d7975048a557 Mon Sep 17 00:00:00 2001
76f8c5
From: Albert Astals Cid <aacid@kde.org>
76f8c5
Date: Mon, 15 Jul 2019 23:24:22 +0200
76f8c5
Subject: [PATCH] JPXStream::init: ignore dict Length if clearly broken
76f8c5
76f8c5
Fixes issue #805
76f8c5
---
76f8c5
 poppler/JPEG2000Stream.cc | 2 +-
76f8c5
 1 file changed, 1 insertion(+), 1 deletion(-)
76f8c5
76f8c5
diff --git a/poppler/JPEG2000Stream.cc b/poppler/JPEG2000Stream.cc
76f8c5
index 0eea3a2d..8e6902f4 100644
76f8c5
--- a/poppler/JPEG2000Stream.cc
76f8c5
+++ b/poppler/JPEG2000Stream.cc
76f8c5
@@ -219,7 +219,7 @@ void JPXStream::init()
76f8c5
   if (getDict()) getDict()->lookup("Length", &oLen);
76f8c5
 
76f8c5
   int bufSize = BUFFER_INITIAL_SIZE;
76f8c5
-  if (oLen.isInt()) bufSize = oLen.getInt();
76f8c5
+  if (oLen.isInt() && oLen.getInt() > 0) bufSize = oLen.getInt();
76f8c5
   oLen.free();
76f8c5
 
76f8c5
   
76f8c5
-- 
76f8c5
2.21.0
76f8c5