From 23c16ec47cec92566b426168ed53c795116b56f6 Mon Sep 17 00:00:00 2001 From: Thorsten Behrens Date: Tue, 13 Dec 2011 20:56:17 +0100 Subject: Fix abort from stl debug iterators' invalid access. Triggered by fdo#43725, incrementing an invalid iterator bombs - though this seems a corner case, depends on whether one considers "+= 0" as incrementing or not. --- basegfx/source/polygon/b2dpolypolygon.cxx | 6 ++++-- basegfx/source/polygon/b3dpolypolygon.cxx | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'basegfx/source/polygon') diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx index bdd619fb0033..3ec0ed824347 100644 --- a/basegfx/source/polygon/b2dpolypolygon.cxx +++ b/basegfx/source/polygon/b2dpolypolygon.cxx @@ -84,7 +84,8 @@ public: { // add nCount copies of rPolygon PolygonVector::iterator aIndex(maPolygons.begin()); - aIndex += nIndex; + if( nIndex ) + aIndex += nIndex; maPolygons.insert(aIndex, nCount, rPolygon); } } @@ -93,7 +94,8 @@ public: { // add all polygons from rPolyPolygon PolygonVector::iterator aIndex(maPolygons.begin()); - aIndex += nIndex; + if( nIndex ) + aIndex += nIndex; maPolygons.insert(aIndex, rPolyPolygon.begin(), rPolyPolygon.end()); } diff --git a/basegfx/source/polygon/b3dpolypolygon.cxx b/basegfx/source/polygon/b3dpolypolygon.cxx index cbd59b6ac362..be1db5e98efb 100644 --- a/basegfx/source/polygon/b3dpolypolygon.cxx +++ b/basegfx/source/polygon/b3dpolypolygon.cxx @@ -83,7 +83,8 @@ public: { // add nCount copies of rPolygon PolygonVector::iterator aIndex(maPolygons.begin()); - aIndex += nIndex; + if( nIndex ) + aIndex += nIndex; maPolygons.insert(aIndex, nCount, rPolygon); } } @@ -92,7 +93,8 @@ public: { // add all polygons from rPolyPolygon PolygonVector::iterator aIndex(maPolygons.begin()); - aIndex += nIndex; + if( nIndex ) + aIndex += nIndex; maPolygons.insert(aIndex, rPolyPolygon.begin(), rPolyPolygon.end()); } -- cgit v1.2.3