summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2021-01-04 23:24:36 +0100
committerAlbert Astals Cid <aacid@kde.org>2021-01-04 23:24:36 +0100
commit9bb28091b64c1b19dcdccb63d50593abc15f627a (patch)
tree4ca1cce91ff95f3c25b718e1713b1c3bfcb6f8ac
parente126be08ea94d829a2d25aabb2ef79cc7bf65d4c (diff)
JBIG2Stream::readSymbolDictSeg: Return early if one of the bitmaps is null
Doesn't seem to regress any of the valid files i have and saves some broken ones that loop for hours
-rw-r--r--poppler/JBIG2Stream.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index 308bf772..db46b1ae 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -15,7 +15,7 @@
//
// Copyright (C) 2006 Raj Kumar <rkumar@archive.org>
// Copyright (C) 2006 Paul Walmsley <paul@booyaka.com>
-// Copyright (C) 2006-2010, 2012, 2014-2020 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2014-2021 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2009 David Benjamin <davidben@mit.edu>
// Copyright (C) 2011 Edward Jiang <ejiang@google.com>
// Copyright (C) 2012 William Bader <williambader@hotmail.com>
@@ -1756,6 +1756,10 @@ bool JBIG2Stream::readSymbolDictSeg(unsigned int segNum, unsigned int length, un
// non-ref/agg coding
} else {
bitmaps[numInputSyms + i] = readGenericBitmap(false, symWidth, symHeight, sdTemplate, false, false, nullptr, sdATX, sdATY, 0).release();
+ if (unlikely(!bitmaps[numInputSyms + i])) {
+ error(errSyntaxError, curStr->getPos(), "NULL bitmap in readGenericBitmap");
+ goto syntaxError;
+ }
}
++i;