poppler/Stream.cc |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit b4b13102716cd33636a94fd99c49487924761670
Author: Albert Astals Cid <[email protected]>
Date:   Sat Jun 1 13:45:53 2013 +0200

    Fix crash on malformed file
    
    Also remove outdated comment
    
    Bug #65221

diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index ffe2638..8eb91bb 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -421,7 +421,6 @@ ImageStream::ImageStream(Stream *strA, int widthA, int 
nCompsA, int nBitsA) {
   nVals = width * nComps;
   inputLineSize = (nVals * nBits + 7) >> 3;
   if (nBits <= 0 || nVals > INT_MAX / nBits - 7) {
-    // force a call to gmallocn(-1,...), which will throw an exception
     inputLineSize = -1;
   }
   inputLine = (Guchar *)gmallocn_checkoverflow(inputLineSize, sizeof(char));
@@ -478,6 +477,10 @@ Guchar *ImageStream::getLine() {
   int c;
   int i;
   Guchar *p;
+  
+  if (unlikely(inputLine == NULL)) {
+      return NULL;
+  }
  
   int readChars = str->doGetChars(inputLineSize, inputLine);
   for ( ; readChars < inputLineSize; readChars++) inputLine[readChars] = EOF;
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to