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

New commits:
commit 4139f79cf8c4e3f529570c9a300491c36f9100e8
Author: Albert Astals Cid <[email protected]>
Date:   Fri May 13 01:31:00 2022 +0200

    TextPage::coalesce: Fix crash on broken files
    
    oss-fuzz/47350

diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 1be85549..3ed1c90d 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -20,7 +20,7 @@
 // Copyright (C) 2006 Jeff Muizelaar <[email protected]>
 // Copyright (C) 2007, 2008, 2012, 2017 Adrian Johnson <[email protected]>
 // Copyright (C) 2008 Koji Otani <[email protected]>
-// Copyright (C) 2008, 2010-2012, 2014-2021 Albert Astals Cid <[email protected]>
+// Copyright (C) 2008, 2010-2012, 2014-2022 Albert Astals Cid <[email protected]>
 // Copyright (C) 2008 Pino Toscano <[email protected]>
 // Copyright (C) 2008, 2010 Hib Eris <[email protected]>
 // Copyright (C) 2009 Ross Moore <[email protected]>
@@ -3637,6 +3637,7 @@ void TextPage::coalesce(bool physLayout, double 
fixedPitch, bool doHTML, double
         envelopes[i].x2 = DBL_MIN;
         envelopes[i].y1 = DBL_MAX;
         envelopes[i].y2 = DBL_MIN;
+        ending_blocks[i] = nullptr;
     }
 
     for (blk1 = blkList; blk1; blk1 = blk1->next) {
@@ -3661,7 +3662,7 @@ void TextPage::coalesce(bool physLayout, double 
fixedPitch, bool doHTML, double
     }
 
     for (blk1 = blkList; blk1; blk1 = blk1->next) {
-        if (blk1->tableId >= 0 && blk1->xMin <= 
ending_blocks[blk1->tableId]->xMax && blk1->xMax >= 
ending_blocks[blk1->tableId]->xMin) {
+        if (blk1->tableId >= 0 && ending_blocks[blk1->tableId] && blk1->xMin 
<= ending_blocks[blk1->tableId]->xMax && blk1->xMax >= 
ending_blocks[blk1->tableId]->xMin) {
             blk1->tableEnd = true;
         }
     }

Reply via email to