Skip to content
Permalink
Browse files

Fix geometry collection can be corrupted by importing incorrect wkb

  • Loading branch information
nyalldawson committed Sep 25, 2017
1 parent 60f81bd commit 623a57a8a03275e9285a22498379d98392bfddf1
Showing with 5 additions and 12 deletions.
  1. +5 −12 src/core/geometry/qgsgeometrycollection.cpp
@@ -183,17 +183,6 @@ void QgsGeometryCollection::transform( const QTransform &t )
clearCache(); //set bounding box invalid
}

#if 0
void QgsGeometryCollection::clip( const QgsRectangle &rect )
{
QVector< QgsAbstractGeometry * >::iterator it = mGeometries.begin();
for ( ; it != mGeometries.end(); ++it )
{
( *it )->clip( rect );
}
}
#endif

void QgsGeometryCollection::draw( QPainter &p ) const
{
QVector< QgsAbstractGeometry * >::const_iterator it = mGeometries.constBegin();
@@ -210,7 +199,11 @@ bool QgsGeometryCollection::fromWkb( QgsConstWkbPtr &wkbPtr )
return false;
}

mWkbType = wkbPtr.readHeader();
QgsWkbTypes::Type wkbType = wkbPtr.readHeader();
if ( QgsWkbTypes::flatType( wkbType ) != QgsWkbTypes::flatType( mWkbType ) )
return false;

mWkbType = wkbType;

int nGeometries = 0;
wkbPtr >> nGeometries;

0 comments on commit 623a57a

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