poppler/JBIG2Stream.cc | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
New commits: commit 30ea3ab8a1eecafb3366aef193910098fdb7ccc8 Author: Albert Astals Cid <[email protected]> Date: Tue May 25 23:07:56 2010 +0100 Fix crash when parsing pdf in bug 28170 This code is a can of crashing worms :-7 diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc index 97994bd..f16ad58 100644 --- a/poppler/JBIG2Stream.cc +++ b/poppler/JBIG2Stream.cc @@ -742,13 +742,18 @@ JBIG2Bitmap *JBIG2Bitmap::getSlice(Guint x, Guint y, Guint wA, Guint hA) { Guint xx, yy; slice = new JBIG2Bitmap(0, wA, hA); - slice->clearToZero(); - for (yy = 0; yy < hA; ++yy) { - for (xx = 0; xx < wA; ++xx) { - if (getPixel(x + xx, y + yy)) { - slice->setPixel(xx, yy); + if (slice->isOk()) { + slice->clearToZero(); + for (yy = 0; yy < hA; ++yy) { + for (xx = 0; xx < wA; ++xx) { + if (getPixel(x + xx, y + yy)) { + slice->setPixel(xx, yy); + } } } + } else { + delete slice; + slice = NULL; } return slice; } @@ -3224,8 +3229,12 @@ void JBIG2Stream::readGenericRefinementRegionSeg(Guint segNum, GBool imm, // store the region bitmap } else { - bitmap->setSegNum(segNum); - segments->append(bitmap); + if (bitmap) { + bitmap->setSegNum(segNum); + segments->append(bitmap); + } else { + error(curStr->getPos(), "readGenericRefinementRegionSeg with null bitmap"); + } } // delete the referenced bitmap _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
