Skip to content

Commit

Permalink
[BUGFIX] QGIS Server segfault when features does not have the same fi…
Browse files Browse the repository at this point in the history
…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 ae162d6 commit 0aed3f7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/server/qgswfsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1702,6 +1702,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 ) )
Expand Down Expand Up @@ -1783,6 +1787,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 ) )
Expand Down Expand Up @@ -1842,6 +1850,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 ) )
Expand Down

0 comments on commit 0aed3f7

Please sign in to comment.