Opened 13 years ago

Last modified 13 years ago

#3771 new defect

Filter parsing does not fail suitably if GML geometry is invalid

Reported by: ejn Owned by: mapserverbugs
Priority: high Milestone:
Component: WFS Server Version: svn-trunk (development)
Severity: normal Keywords: filter, gml, parsing
Cc: sdlime, assefa

Description

FLTParseFilterEncoding returns a superficially valid (passes FLTValidFilterNode) FilterEncodingNode if given a filter with a bad GML geometry (e.g. a Polygon without outer boundary).

This can be traced to FLTInsertElementInNode which does not set the eType to FILTER_NODE_TYPE_UNDEFINED if the geometry is bad and FLTShapeFromGMLTree which returns MS_TRUE and sets no error message even if OGR_G_CreateFromGMLTree returns NULL.

Using a bad GML geometry in a WFS filter query currently therefore results in a WKT read error (obviously the first point where the contents of the geometry in the parsed filter are actually checked!) rather than an invalid filter error. The parsing should however pick up the problem, as other consumers may choke badly.

The attached patch fixes this so that if the geometry is bad then MS_FALSE is returned from FLTShapeFromGMLTree, and an appropriate error message is set, and the returned filter node from FLTInsertElementInNode has eType FILTER_NODE_TYPE_UNDEFINED.

The immediate net result is that giving an invalid geometry in the WFS filter results in an "InvalidParameterValue / Invalid or Unsupported FILTER in GetFeature" exception instead of a rather more cryptic "NoApplicableCode / FLTApplyFilterToLayer() feailed / WKT processing failed / GEOS library error" exception.

Attachments (2)

ms-svn-patch_filter.patch (2.2 KB ) - added by ejn 13 years ago.
Patch to make filter parsing react properly to a bad GML geometry
ms-svn-patch_filter_parsing.patch (2.2 KB ) - added by ejn 13 years ago.
Patch to make filter parsing react properly to a bad GML geometry

Download all attachments as: .zip

Change History (5)

by ejn, 13 years ago

Attachment: ms-svn-patch_filter.patch added

Patch to make filter parsing react properly to a bad GML geometry

by ejn, 13 years ago

Patch to make filter parsing react properly to a bad GML geometry

comment:1 by ejn, 13 years ago

Sorry, uploaded the wrong patch first time: both patches are identical apart from the filename (admin, feel free to delete one of them!)

comment:2 by sdlime, 13 years ago

Component: MapServer C LibraryWFS Server
Owner: changed from sdlime to mapserverbugs

comment:3 by sdlime, 13 years ago

Cc: sdlime assefa added
Note: See TracTickets for help on using tickets.