poppler/Stream.cc |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 2017dbebd9afd4f172242ff8462fce739d911e64
Author: Even Rouault <[email protected]>
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 <[email protected]>
 // Copyright (C) 2012 Oliver Sander <[email protected]>
 // Copyright (C) 2012 Fabio D'Urso <[email protected]>
+// Copyright (C) 2012 Even Rouault <[email protected]>
 //
 // 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 {
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to