summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2013-06-01 13:45:53 +0200
committerAlbert Astals Cid <aacid@kde.org>2013-06-01 13:46:17 +0200
commitb4b13102716cd33636a94fd99c49487924761670 (patch)
treebfb6496fc1a8f083f5570098ab840350057d1a2e
parent56044ef482c26f10a8a1371dace049c144659dc7 (diff)
Fix crash on malformed file
Also remove outdated comment Bug #65221
-rw-r--r--poppler/Stream.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index ffe2638f..8eb91bb4 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;