[poppler] poppler/JBIG2Stream.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Feb 20 21:37:35 UTC 2021


 poppler/JBIG2Stream.cc |    1 +
 1 file changed, 1 insertion(+)

New commits:
commit 5161fa6f1ff9f7d2c19b5326aed6ad2858c30476
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat Feb 20 22:30:14 2021 +0100

    Fix memory leak in broken file in JBIG2Stream::readGenericBitmap
    
    It could happen that codingLine succeeds but refLine fails because we're
    just on the edge of the allocatable memory so free codingLine just in
    case

diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index 6bda5f92..70996085 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -2807,6 +2807,7 @@ std::unique_ptr<JBIG2Bitmap> JBIG2Stream::readGenericBitmap(bool mmr, int w, int
         refLine = (int *)gmallocn_checkoverflow(w + 2, sizeof(int));
 
         if (unlikely(!codingLine || !refLine)) {
+            gfree(codingLine);
             error(errSyntaxError, curStr->getPos(), "Bad width in JBIG2 generic bitmap");
             return nullptr;
         }


More information about the poppler mailing list