Skip to content
Permalink
Browse files

Merge pull request #2868 from manisandro/next_vertex

Fix out of bounds array access if nextVertex is called on empty geometry collection
  • Loading branch information
nyalldawson committed Mar 6, 2016
2 parents 42d8884 + 1e90786 commit c50161d0bedfcc9c741bf51d0fada7c3e7102763
Showing with 8 additions and 0 deletions.
  1. +4 −0 src/core/geometry/qgsgeometrycollectionv2.cpp
  2. +4 −0 tests/src/core/testqgsgeometry.cpp
@@ -374,6 +374,10 @@ bool QgsGeometryCollectionV2::nextVertex( QgsVertexId& id, QgsPointV2& vertex )
id.ring = -1;
id.vertex = -1;
}
if ( mGeometries.isEmpty() )
{
return false;
}

QgsAbstractGeometryV2* geom = mGeometries.at( id.part );
if ( geom->nextVertex( id, vertex ) )
@@ -34,6 +34,7 @@
#include "qgslinestringv2.h"
#include "qgspolygonv2.h"
#include "qgscircularstringv2.h"
#include "qgsgeometrycollectionv2.h"

//qgs unit test utility class
#include "qgsrenderchecker.h"
@@ -360,6 +361,9 @@ void TestQgsGeometry::isEmpty()

geom.setGeometry( 0 );
QVERIFY( geom.isEmpty() );

QgsGeometryCollectionV2 collection;
QVERIFY( collection.isEmpty() );
}

void TestQgsGeometry::pointV2()

0 comments on commit c50161d

Please sign in to comment.
You can’t perform that action at this time.