summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2017-09-19 21:19:03 +0200
committerAlbert Astals Cid <aacid@kde.org>2017-09-19 21:19:03 +0200
commit939465c40902d72e0c05d4f3a27ee67e4a007ed7 (patch)
treecc4195192f9870cbd72bee8a200b721e1181a502
parenta8aa61f774503c9ebd840e148c4fa31a6959600d (diff)
Fix crash in broken files
Bug #102854
-rw-r--r--poppler/Stream.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index f4eda85b..0ad602c7 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -454,11 +454,10 @@ ImageStream::ImageStream(Stream *strA, int widthA, int nCompsA, int nBitsA) {
} else {
imgLineSize = nVals;
}
- if (width > INT_MAX / nComps) {
- // force a call to gmallocn(-1,...), which will throw an exception
+ if (nComps <= 0 || width > INT_MAX / nComps) {
imgLineSize = -1;
}
- imgLine = (Guchar *)gmallocn(imgLineSize, sizeof(Guchar));
+ imgLine = (Guchar *)gmallocn_checkoverflow(imgLineSize, sizeof(Guchar));
}
imgIdx = nVals;
}