Skip to content
Permalink
Browse files

Ensure ogr, postgis and memory providers reject features

with too many attributes
  • Loading branch information
nyalldawson committed Feb 17, 2018
1 parent 4ae476d commit 7187ae35448d654a5acde62f32cf2734e9d683f3
@@ -343,6 +343,7 @@ QgsCoordinateReferenceSystem QgsMemoryProvider::crs() const

bool QgsMemoryProvider::addFeatures( QgsFeatureList &flist, Flags )
{
bool result = true;
// whether or not to update the layer extent on the fly as we add features
bool updateExtent = mFeatures.isEmpty() || !mExtent.isEmpty();

@@ -364,6 +365,12 @@ bool QgsMemoryProvider::addFeatures( QgsFeatureList &flist, Flags )
}
it->setAttributes( attributes );
}
else if ( it->attributes().count() > fieldCount )
{
// too many attributes
result = false;
continue;
}

mFeatures.insert( mNextFeatureId, *it );

@@ -380,7 +387,7 @@ bool QgsMemoryProvider::addFeatures( QgsFeatureList &flist, Flags )
mNextFeatureId++;
}

return true;
return result;
}

bool QgsMemoryProvider::deleteFeatures( const QgsFeatureIds &id )
@@ -1328,7 +1328,7 @@ bool QgsOgrProvider::addFeaturePrivate( QgsFeature &f, Flags flags )
{
// don't try to set field from attribute map if it's not present in layer
if ( ogrAttId >= fdef.GetFieldCount() )
continue;
return false;

//if(!s.isEmpty())
// continue;
@@ -2148,6 +2148,12 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist, Flags flags )
{
QgsAttributes attrs = features->attributes();

if ( attrs.count() > mAttributeFields.count() )
{
returnvalue = false;
continue;
}

QStringList params;
if ( !mGeometryColumn.isNull() )
{

0 comments on commit 7187ae3

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