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 dceb142 commit 28d2547
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/server/qgswfsserver.cpp
Expand Up @@ -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 ) )
Expand Down Expand Up @@ -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 ) )
Expand Down Expand Up @@ -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 ) )
Expand Down

0 comments on commit 28d2547

Please sign in to comment.