[poppler] poppler/JBIG2Stream.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Dec 30 19:12:11 UTC 2020


 poppler/JBIG2Stream.cc |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 3cb5d2531fd63bf136b016462c627ad45919a7ca
Author: Oliver Sander <oliver.sander at tu-dresden.de>
Date:   Wed Dec 30 07:08:52 2020 +0100

    Fix regression in JBIG2Stream.cc
    
    The recent commit 216ae4f058d2652f1795c7f840014cc69ee06408
    broke reading of certain JBIG2 images.  This commit fixes
    it again, by bringing the JBIG2Stream::reset() method
    back in line with what xpdf-4.02 does.

diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index 04b4c460..224c1a2f 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -1131,9 +1131,7 @@ void JBIG2Stream::reset()
     freeSegments();
 
     // read the globals stream
-    globalSegments.resize(0);
     if (globalsStream.isStream()) {
-        segments = globalSegments;
         curStr = globalsStream.getStream();
         curStr->reset();
         arithDecoder->setStream(curStr);
@@ -1141,10 +1139,11 @@ void JBIG2Stream::reset()
         mmrDecoder->setStream(curStr);
         readSegments();
         curStr->close();
+        // swap the newly read segments list into globalSegments
+        std::swap(segments, globalSegments);
     }
 
     // read the main stream
-    segments.resize(0);
     curStr = str;
     curStr->reset();
     arithDecoder->setStream(curStr);


More information about the poppler mailing list