[poppler] poppler/JBIG2Stream.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Wed May 20 13:44:03 PDT 2009


 poppler/JBIG2Stream.cc |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 548c72600b8a5e076647041660ed5031feedc7cc
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed May 20 22:43:11 2009 +0200

    Do not exit(1) on a pdf i have lying around
    
    PDF is 0f03b3539a436a9f18d7e4e29d410f89  6607907.pdf

diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index 16cf1d8..57ec42b 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -1024,6 +1024,7 @@ public:
   Guint getSize() { return size; }
   void setBitmap(Guint idx, JBIG2Bitmap *bitmap) { bitmaps[idx] = bitmap; }
   JBIG2Bitmap *getBitmap(Guint idx) { return bitmaps[idx]; }
+  GBool isOk() { return bitmaps != NULL; }
   void setGenericRegionStats(JArithmeticDecoderStats *stats)
     { genericRegionStats = stats; }
   void setRefinementRegionStats(JArithmeticDecoderStats *stats)
@@ -1045,7 +1046,8 @@ JBIG2SymbolDict::JBIG2SymbolDict(Guint segNumA, Guint sizeA):
   JBIG2Segment(segNumA)
 {
   size = sizeA;
-  bitmaps = (JBIG2Bitmap **)gmallocn(size, sizeof(JBIG2Bitmap *));
+  bitmaps = (JBIG2Bitmap **)gmallocn_checkoverflow(size, sizeof(JBIG2Bitmap *));
+  if (!bitmaps) size = 0;
   genericRegionStats = NULL;
   refinementRegionStats = NULL;
 }
@@ -1816,6 +1818,10 @@ GBool JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length,
 
   // create the symbol dict object
   symbolDict = new JBIG2SymbolDict(segNum, numExSyms);
+  if (!symbolDict->isOk()) {
+    delete symbolDict;
+    goto syntaxError;
+  }
 
   // exported symbol list
   i = j = 0;


More information about the poppler mailing list