diff options
author | Albert Astals Cid <aacid@kde.org> | 2022-05-13 01:31:00 +0200 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2022-05-13 01:31:59 +0200 |
commit | 4139f79cf8c4e3f529570c9a300491c36f9100e8 (patch) | |
tree | 4f72c4e8959df18d7b5df1a7912f7e7e0ab6327a | |
parent | 4eeb3380ea77d277ace735f191f303564a25a0e3 (diff) |
TextPage::coalesce: Fix crash on broken files
oss-fuzz/47350
-rw-r--r-- | poppler/TextOutputDev.cc | 5 |
1 files changed, 3 insertions, 2 deletions
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 <jeff@infidigm.net> // Copyright (C) 2007, 2008, 2012, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2008 Koji Otani <sho@bbr.jp> -// Copyright (C) 2008, 2010-2012, 2014-2021 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2008, 2010-2012, 2014-2022 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2008 Pino Toscano <pino@kde.org> // Copyright (C) 2008, 2010 Hib Eris <hib@hiberis.nl> // Copyright (C) 2009 Ross Moore <ross@maths.mq.edu.au> @@ -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; } } |