summaryrefslogtreecommitdiff
blob: ded0e07205a7adf0f82e295449844b0dec9e2166 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--- filters/kword/pdf/xpdf/xpdf/Stream.cc
+++ filters/kword/pdf/xpdf/xpdf/Stream.cc
@@ -413,13 +413,11 @@ StreamPredictor::StreamPredictor(Stream 
   predLine = NULL;
   ok = gFalse;
 
-  if (width <= 0 || nComps <= 0 || nBits <= 0 ||
-     nComps >= INT_MAX / nBits ||
-      width >= INT_MAX / nComps / nBits)
-    return;
-
   nVals = width * nComps;
-  if (nVals * nBits + 7 <= 0)
+  if (width <= 0 || nComps <= 0 || nBits <= 0 ||
+     nComps >= 4 || nBits > 16 ||
+      width >= INT_MAX / nComps ||
+      nVals >= (INT_MAX - 7) / nBits)
     return;
 
   pixBytes = (nComps * nBits + 7) >> 3;