[poppler] poppler/JBIG2Stream.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Aug 21 09:38:26 UTC 2021


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

New commits:
commit dd507d1a460470298b749802285fce216226f417
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat Aug 21 11:38:11 2021 +0200

    Revert 73a236b23de3c0337bed0f89cb713c7831e2ad05
    
    It causes rendering regressions

diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index 5def0be3..725b2cf9 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -1284,10 +1284,7 @@ void JBIG2Stream::readSegments()
         }
 
         // referred-to segment numbers
-        refSegs = (unsigned int *)gmallocn_checkoverflow(nRefSegs, sizeof(unsigned int));
-        if (!refSegs) {
-            return;
-        }
+        refSegs = (unsigned int *)gmallocn(nRefSegs, sizeof(unsigned int));
         if (segNum <= 256) {
             for (unsigned int i = 0; i < nRefSegs; ++i) {
                 if (!readUByte(&refSegs[i])) {
@@ -1657,10 +1654,7 @@ bool JBIG2Stream::readSymbolDictSeg(unsigned int segNum, unsigned int length, un
 
     // allocate symbol widths storage
     if (huff && !refAgg) {
-        symWidths = (unsigned int *)gmallocn_checkoverflow(numNewSyms, sizeof(unsigned int));
-        if (!symWidths) {
-            goto syntaxError;
-        }
+        symWidths = (unsigned int *)gmallocn(numNewSyms, sizeof(unsigned int));
     }
 
     symHeight = 0;
@@ -1991,10 +1985,7 @@ void JBIG2Stream::readTextRegionSeg(unsigned int segNum, bool imm, bool lossless
     }
 
     // get the symbol bitmaps
-    syms = (JBIG2Bitmap **)gmallocn_checkoverflow(numSyms, sizeof(JBIG2Bitmap *));
-    if (!syms) {
-        return;
-    }
+    syms = (JBIG2Bitmap **)gmallocn(numSyms, sizeof(JBIG2Bitmap *));
     kk = 0;
     for (i = 0; i < nRefSegs; ++i) {
         if ((seg = findSegment(refSegs[i]))) {
@@ -2122,11 +2113,7 @@ void JBIG2Stream::readTextRegionSeg(unsigned int segNum, bool imm, bool lossless
     }
 
     if (huff) {
-        symCodeTab = (JBIG2HuffmanTable *)gmallocn_checkoverflow(numSyms + 1, sizeof(JBIG2HuffmanTable));
-        if (!symCodeTab) {
-            gfree(syms);
-            return;
-        }
+        symCodeTab = (JBIG2HuffmanTable *)gmallocn(numSyms + 1, sizeof(JBIG2HuffmanTable));
         for (i = 0; i < numSyms; ++i) {
             symCodeTab[i].val = i;
             symCodeTab[i].rangeLen = 0;
@@ -2620,10 +2607,7 @@ void JBIG2Stream::readHalftoneRegionSeg(unsigned int segNum, bool imm, bool loss
     }
 
     // read the gray-scale image
-    grayImg = (unsigned int *)gmallocn_checkoverflow(gridW * gridH, sizeof(unsigned int));
-    if (!grayImg) {
-        return;
-    }
+    grayImg = (unsigned int *)gmallocn(gridW * gridH, sizeof(unsigned int));
     memset(grayImg, 0, gridW * gridH * sizeof(unsigned int));
     atx[0] = templ <= 1 ? 3 : 2;
     aty[0] = -1;


More information about the poppler mailing list