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 ae162d6 commit 0aed3f715b237dd2cd789b0e0638027d7b5ee00b
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/server/qgswfsserver.cpp
@@ -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 ) )
@@ -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 ) )
@@ -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 ) )

0 comments on commit 0aed3f7

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