[poppler] poppler/Stream.cc
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 27 09:55:41 UTC 2023
poppler/Stream.cc | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
New commits:
commit 2cf3cf58ed9f70b99e6ee93c57bb434a52a0e857
Author: Albert Astals Cid <aacid at kde.org>
Date: Thu Apr 27 11:50:45 2023 +0200
Check overflow in nvals correctly
diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index 07720632..42d18880 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff at infidigm.net>
-// Copyright (C) 2006-2010, 2012-2014, 2016-2021 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006-2010, 2012-2014, 2016-2021, 2023 Albert Astals Cid <aacid at kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien at fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc at gnome.org>
@@ -728,9 +728,10 @@ StreamPredictor::StreamPredictor(Stream *strA, int predictorA, int widthA, int n
predLine = nullptr;
ok = false;
- nVals = width * nComps;
- 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
+ if (checkedMultiply(width, nComps, &nVals)) {
+ return;
+ }
+ if (width <= 0 || nComps <= 0 || nBits <= 0 || nComps > gfxColorMaxComps || nBits > 16 || nVals >= (INT_MAX - 7) / nBits) { // check for overflow in rowBytes
return;
}
pixBytes = (nComps * nBits + 7) >> 3;
More information about the poppler
mailing list