From 1fd290f24398cb9145662ec9e029af4f901765fd Mon Sep 17 00:00:00 2001 From: Marco Hugentobler Date: Tue, 29 Nov 2016 14:28:51 +0100 Subject: [PATCH] WMS 1.3.0 compliance: throw exception if bbox is empty --- src/server/qgswmsserver.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/server/qgswmsserver.cpp b/src/server/qgswmsserver.cpp index 8a0713a0c94..50f9fede800 100644 --- a/src/server/qgswmsserver.cpp +++ b/src/server/qgswmsserver.cpp @@ -694,6 +694,10 @@ static QgsRectangle _parseBBOX( const QString &bboxStr, bool &ok ) } ok = true; + if ( d[2] <= d[0] || d[3] <= d[1] ) + { + throw QgsMapServiceException( "InvalidParameterValue", "BBOX is empty" ); + } return QgsRectangle( d[0], d[1], d[2], d[3] ); } @@ -2044,6 +2048,11 @@ int QgsWmsServer::configureMapRender( const QPaintDevice* paintDevice ) const throw QgsMapServiceException( QStringLiteral( "InvalidParameterValue" ), QStringLiteral( "Invalid BBOX parameter" ) ); } + if ( mapExtent.isEmpty() ) + { + throw QgsMapServiceException( "InvalidParameterValue", "BBOX is empty" ); + } + QgsUnitTypes::DistanceUnit mapUnits = QgsUnitTypes::DistanceDegrees; QString crs = mParameters.value( QStringLiteral( "CRS" ), mParameters.value( QStringLiteral( "SRS" ) ) );