Skip to content
Permalink
Browse files

[BUGFIX] QGIS Server segfault when features does not have the same fi…

…elds as the layer.

In some WFS GetFeature request, with Filter or FeatureId, all the fields are not well loaded in the feature.

To fix it, we just verifying that the attribute index is lesser than the feature fields count.

Fixes #14619
  • Loading branch information
rldhont committed Apr 8, 2016
1 parent dceb142 commit 28d2547a7dba8fd17959c47a54b9676def19fdb1
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/server/qgswfsserver.cpp
@@ -1897,6 +1897,10 @@ QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, int prec, QgsCoord
for ( int i = 0; i < attrIndexes.count(); ++i )
{
int idx = attrIndexes[i];
if ( idx >= fields->count() )
{
continue;
}
QString attributeName = fields->at( idx ).name();
//skip attribute if it is excluded from WFS publication
if ( excludedAttributes.contains( attributeName ) )
@@ -1992,6 +1996,10 @@ QDomElement QgsWFSServer::createFeatureGML2( QgsFeature* feat, QDomDocument& doc
for ( int i = 0; i < attrIndexes.count(); ++i )
{
int idx = attrIndexes[i];
if ( idx >= fields->count() )
{
continue;
}
QString attributeName = fields->at( idx ).name();
//skip attribute if it is excluded from WFS publication
if ( excludedAttributes.contains( attributeName ) )
@@ -2065,6 +2073,10 @@ QDomElement QgsWFSServer::createFeatureGML3( QgsFeature* feat, QDomDocument& doc
for ( int i = 0; i < attrIndexes.count(); ++i )
{
int idx = attrIndexes[i];
if ( idx >= fields->count() )
{
continue;
}
QString attributeName = fields->at( idx ).name();
//skip attribute if it is excluded from WFS publication
if ( excludedAttributes.contains( attributeName ) )

0 comments on commit 28d2547

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