diff -Naur poppler-0.5.4/poppler/Stream.cc poppler-0.5.4-fixed/poppler/Stream.cc --- poppler-0.5.4/poppler/Stream.cc 2006-07-28 20:07:41.000000000 +0200 +++ poppler-0.5.4-fixed/poppler/Stream.cc 2007-08-03 18:53:08.000000000 +0200 @@ -422,12 +422,6 @@ ok = gFalse; nVals = width * nComps; - if (width <= 0 || nComps <= 0 || nBits <= 0 || - nComps >= INT_MAX/nBits || - width >= INT_MAX/nComps/nBits || - nVals * nBits + 7 < 0) { - return; - } totalBits = nVals * nBits; if (totalBits == 0 || (totalBits / nBits) / nComps != width || @@ -436,7 +430,11 @@ } pixBytes = (nComps * nBits + 7) >> 3; rowBytes = ((totalBits + 7) >> 3) + pixBytes; - if (rowBytes < 0) { + if (width <= 0 || nComps <= 0 || nBits <= 0 || + nComps > gfxColorMaxComps || + nBits > 16 || + width >= INT_MAX / nComps || // check for overflow in nVals + nVals >= (INT_MAX - 7) / nBits) { // check for overflow in rowBytes return; } predLine = (Guchar *)gmalloc(rowBytes);