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

New commits:
commit 5161fa6f1ff9f7d2c19b5326aed6ad2858c30476
Author: Albert Astals Cid <[email protected]>
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;
         }
_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to