summaryrefslogtreecommitdiff
path: root/Build/source/libs/xpdf/xpdf/Stream.cc
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/xpdf/xpdf/Stream.cc')
-rw-r--r--Build/source/libs/xpdf/xpdf/Stream.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/Build/source/libs/xpdf/xpdf/Stream.cc b/Build/source/libs/xpdf/xpdf/Stream.cc
index 68abafa7b8d..f96b52488c0 100644
--- a/Build/source/libs/xpdf/xpdf/Stream.cc
+++ b/Build/source/libs/xpdf/xpdf/Stream.cc
@@ -410,15 +410,13 @@ StreamPredictor::StreamPredictor(Stream *strA, int predictorA,
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;
- }
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);