Skip to content
Permalink
Browse files

[BUGFIX] QGIS Server segfault if layer extent is null

  • Loading branch information
rldhont committed Apr 20, 2016
1 parent d4af38b commit 142ce5e07f432936856f045e58610016c8124341
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/server/qgsconfigparserutils.cpp
@@ -92,8 +92,12 @@ void QgsConfigParserUtils::appendLayerBoundingBoxes( QDomElement& layerElem, QDo
//Ex_GeographicBoundingBox
QDomElement ExGeoBBoxElement;
//transform the layers native CRS into WGS84
QgsCoordinateTransform exGeoTransform( layerCRS, wgs84 );
QgsRectangle wgs84BoundingRect = exGeoTransform.transformBoundingBox( layerExtent );
QgsRectangle wgs84BoundingRect;
if ( !layerExtent.isNull() )
{
QgsCoordinateTransform exGeoTransform( layerCRS, wgs84 );
wgs84BoundingRect = exGeoTransform.transformBoundingBox( layerExtent );

This comment has been minimized.

Copy link
@nyalldawson

nyalldawson Apr 20, 2016

Collaborator

@rldhont this should be wrapped in a try ... catch QgsCsException block. Otherwise invalid reprojections would also crash server.

Note that coverity has flagged numerous places in server with the same issue (uncaught QgsCsException errors), which would also crash server. Have you got access to Coverity to see these reports?

}
if ( version == "1.1.1" ) // WMS Version 1.1.1
{
ExGeoBBoxElement = doc.createElement( "LatLonBoundingBox" );
@@ -185,8 +189,12 @@ void QgsConfigParserUtils::appendLayerBoundingBox( QDomElement& layerElem, QDomD
const QgsCoordinateReferenceSystem& crs = QgsCRSCache::instance()->crsByAuthId( crsText );

//transform the layers native CRS into CRS
QgsCoordinateTransform crsTransform( layerCRS, crs );
QgsRectangle crsExtent = crsTransform.transformBoundingBox( layerExtent );
QgsRectangle crsExtent;
if ( !layerExtent.isNull() )
{
QgsCoordinateTransform crsTransform( layerCRS, crs );
crsExtent = crsTransform.transformBoundingBox( layerExtent );
}

//BoundingBox element
QDomElement bBoxElement = doc.createElement( "BoundingBox" );

0 comments on commit 142ce5e

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