poppler/Gfx.cc | 28 +++++++++++++++++----------- poppler/GfxState.cc | 10 +++++++--- 2 files changed, 24 insertions(+), 14 deletions(-)
New commits: commit 7ce86b9be058408eb567d8d0b9747853a66c116f Author: Albert Astals Cid <[email protected]> Date: Thu Jan 8 17:35:28 2015 +0100 Remove assert in gouraudFillTriangle We don't *need* the assert, an error() is fine and the malformed document will just get rendered wrongly instead of "crashing" Bugs #85274 diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc index 6ad1b2c..07d95b3 100644 --- a/poppler/Gfx.cc +++ b/poppler/Gfx.cc @@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Jonathan Blandford <[email protected]> -// Copyright (C) 2005-2013 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2013, 2015 Albert Astals Cid <[email protected]> // Copyright (C) 2006 Thorkild Stray <[email protected]> // Copyright (C) 2006 Kristian Høgsberg <[email protected]> // Copyright (C) 2006-2011 Carlos Garcia Campos <[email protected]> @@ -3355,6 +3355,12 @@ void Gfx::doGouraudTriangleShFill(GfxGouraudTriangleShading *shading) { delete reusablePath; } +static inline void checkTrue(bool b, const char *message) { + if (unlikely(!b)) { + error(errSyntaxError, -1, message); + } +} + void Gfx::gouraudFillTriangle(double x0, double y0, GfxColor *color0, double x1, double y1, GfxColor *color1, double x2, double y2, GfxColor *color2, @@ -3373,11 +3379,11 @@ void Gfx::gouraudFillTriangle(double x0, double y0, GfxColor *color0, state->setFillColor(color0); out->updateFillColor(state); - path->reset(); assert(!path->isEnd()); - path->setCoord(x0,y0); path->next(); assert(!path->isEnd()); - path->setCoord(x1,y1); path->next(); assert(!path->isEnd()); - path->setCoord(x2,y2); path->next(); assert(!path->isEnd()); - path->setCoord(x0,y0); path->next(); assert( path->isEnd()); + path->reset(); checkTrue(!path->isEnd(), "Path should not be at end"); + path->setCoord(x0,y0); path->next(); checkTrue(!path->isEnd(), "Path should not be at end"); + path->setCoord(x1,y1); path->next(); checkTrue(!path->isEnd(), "Path should not be at end"); + path->setCoord(x2,y2); path->next(); checkTrue(!path->isEnd(), "Path should not be at end"); + path->setCoord(x0,y0); path->next(); checkTrue( path->isEnd(), "Path should be at end"); out->fill(state); } else { @@ -3420,11 +3426,11 @@ void Gfx::gouraudFillTriangle(double x0, double y0, double color0, state->setFillColor(&color); out->updateFillColor(state); - path->reset(); assert(!path->isEnd()); - path->setCoord(x0,y0); path->next(); assert(!path->isEnd()); - path->setCoord(x1,y1); path->next(); assert(!path->isEnd()); - path->setCoord(x2,y2); path->next(); assert(!path->isEnd()); - path->setCoord(x0,y0); path->next(); assert( path->isEnd()); + path->reset(); checkTrue(!path->isEnd(), "Path should not be at end"); + path->setCoord(x0,y0); path->next(); checkTrue(!path->isEnd(), "Path should not be at end"); + path->setCoord(x1,y1); path->next(); checkTrue(!path->isEnd(), "Path should not be at end"); + path->setCoord(x2,y2); path->next(); checkTrue(!path->isEnd(), "Path should not be at end"); + path->setCoord(x0,y0); path->next(); checkTrue( path->isEnd(), "Path should be at end"); out->fill(state); } else { commit 9e9df4b20d17478996780008bc9802a857d173fc Author: Albert Astals Cid <[email protected]> Date: Thu Jan 8 17:01:52 2015 +0100 Fix crash on broken document Bug #85281 diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc index 359c0d6..b439942 100644 --- a/poppler/GfxState.cc +++ b/poppler/GfxState.cc @@ -16,7 +16,7 @@ // Copyright (C) 2005 Kristian Høgsberg <[email protected]> // Copyright (C) 2006, 2007 Jeff Muizelaar <[email protected]> // Copyright (C) 2006, 2010 Carlos Garcia Campos <[email protected]> -// Copyright (C) 2006-2014 Albert Astals Cid <[email protected]> +// Copyright (C) 2006-2015 Albert Astals Cid <[email protected]> // Copyright (C) 2009, 2012 Koji Otani <[email protected]> // Copyright (C) 2009, 2011-2014 Thomas Freitag <[email protected]> // Copyright (C) 2009 Christian Persch <[email protected]> @@ -3048,8 +3048,12 @@ GfxColorSpace *GfxDeviceNColorSpace::copy() { int *mappingA = NULL; GooList *sepsCSA = new GooList(sepsCS->getLength()); - for (i = 0; i < sepsCS->getLength(); i++) - sepsCSA->append(((GfxSeparationColorSpace *) sepsCS->get(i))->copy()); + for (i = 0; i < sepsCS->getLength(); i++) { + GfxSeparationColorSpace *scs = (GfxSeparationColorSpace *) sepsCS->get(i); + if (likely(scs)) { + sepsCSA->append(scs->copy()); + } + } if (mapping != NULL) { mappingA = (int *)gmalloc(sizeof(int) * nComps); for (i = 0; i < nComps; i++)
_______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
