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