[poppler] poppler/Stream.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Thu Dec 27 15:37:22 PST 2012
poppler/Stream.cc | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
New commits:
commit 2017dbebd9afd4f172242ff8462fce739d911e64
Author: Even Rouault <even.rouault at mines-paris.org>
Date: Fri Dec 28 00:30:13 2012 +0100
Do not crash on 0 or negative nBits values
diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index 842f0c6..414ff3f 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -26,6 +26,7 @@
// Copyright (C) 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
// Copyright (C) 2012 Oliver Sander <sander at mi.fu-berlin.de>
// Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
+// Copyright (C) 2012 Even Rouault <even.rouault at mines-paris.org>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -419,11 +420,11 @@ ImageStream::ImageStream(Stream *strA, int widthA, int nCompsA, int nBitsA) {
nVals = width * nComps;
inputLineSize = (nVals * nBits + 7) >> 3;
- if (nVals > INT_MAX / nBits - 7) {
+ if (nBits <= 0 || nVals > INT_MAX / nBits - 7) {
// force a call to gmallocn(-1,...), which will throw an exception
inputLineSize = -1;
}
- inputLine = (Guchar *)gmallocn(inputLineSize, sizeof(char));
+ inputLine = (Guchar *)gmallocn_checkoverflow(inputLineSize, sizeof(char));
if (nBits == 8) {
imgLine = (Guchar *)inputLine;
} else {
More information about the poppler
mailing list