[poppler] poppler/JBIG2Stream.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 24 22:20:57 UTC 2022


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

New commits:
commit 27354e9d9696ee2bc063910a6c9a6b27c5184a52
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Aug 25 00:14:22 2022 +0200

    JBIG2Stream: Fix crash on broken file
    
    https://github.com/jeffssh/CVE-2021-30860
    
    Thanks to David Warren for the heads up

diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index 662276e5..9f70431d 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -1976,7 +1976,11 @@ void JBIG2Stream::readTextRegionSeg(unsigned int segNum, bool imm, bool lossless
     for (i = 0; i < nRefSegs; ++i) {
         if ((seg = findSegment(refSegs[i]))) {
             if (seg->getType() == jbig2SegSymbolDict) {
-                numSyms += ((JBIG2SymbolDict *)seg)->getSize();
+                const unsigned int segSize = ((JBIG2SymbolDict *)seg)->getSize();
+                if (unlikely(checkedAdd(numSyms, segSize, &numSyms))) {
+                    error(errSyntaxError, getPos(), "Too many symbols in JBIG2 text region");
+                    return;
+                }
             } else if (seg->getType() == jbig2SegCodeTable) {
                 codeTables.push_back(seg);
             }


More information about the poppler mailing list