summaryrefslogtreecommitdiffstats
path: root/kpdf/xpdf/xpdf/Stream.cc
diff options
context:
space:
mode:
Diffstat (limited to 'kpdf/xpdf/xpdf/Stream.cc')
-rw-r--r--kpdf/xpdf/xpdf/Stream.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/kpdf/xpdf/xpdf/Stream.cc b/kpdf/xpdf/xpdf/Stream.cc
index ab630241..20219522 100644
--- a/kpdf/xpdf/xpdf/Stream.cc
+++ b/kpdf/xpdf/xpdf/Stream.cc
@@ -410,15 +410,12 @@ StreamPredictor::StreamPredictor(Stream *strA, int predictorA,
ok = gFalse;
nVals = width * nComps;
- if (width <= 0 || nComps <= 0 || nBits <= 0 ||
- nComps > gfxColorMaxComps || nBits > 16 ||
- width >= INT_MAX / nComps ||
- nVals >= (INT_MAX - 7) / nBits) {
- return;
- }
pixBytes = (nComps * nBits + 7) >> 3;
rowBytes = ((nVals * nBits + 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);