poppler/JBIG2Stream.cc |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 15960417f2fef7e8b94acda712e65e9b5383494c
Author: Albert Astals Cid <[email protected]>
Date:   Wed Nov 18 20:14:37 2020 +0100

    JBIG2Stream::readTextRegion: Fix integer overflow on broken files

diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index a80806c4..ae7d6306 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -2240,7 +2240,9 @@ JBIG2Bitmap *JBIG2Stream::readTextRegion(bool huff, bool 
refine, int w, int h, u
         } else {
             arithDecoder->decodeInt(&ds, iafsStats);
         }
-        sFirst += ds;
+        if (unlikely(checkedAdd(sFirst, ds, &sFirst))) {
+            return nullptr;
+        }
         s = sFirst;
 
         // read the instances
_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to