From: Paul Ramsey Date: Fri, 7 Sep 2012 20:05:25 +0000 (+0000) Subject: ST_GeomFromGML on CurvePolygon causes server crash (#1936) X-Git-Tag: 2.1.0beta2~666 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=66dacff9f259ed9a8aaf9e779c7f677014e97d64;p=postgis ST_GeomFromGML on CurvePolygon causes server crash (#1936) git-svn-id: http://svn.osgeo.org/postgis/trunk@10255 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/NEWS b/NEWS index da92ac853..3d4041e96 100644 --- a/NEWS +++ b/NEWS @@ -44,6 +44,7 @@ PostGIS 2.1.0 - #1875, ST_SummaryStats returns NULL for all parameters except count when count is zero - #1932, fix raster2pgsql of syntax for index tablespaces + - #1936, ST_GeomFromGML on CurvePolygon causes server crash - #1939, remove custom data types: summarystats, histogram, quantile, valuecount - #1951, remove crash on zero-length linestrings - #1957, ST_Distance to a one-point LineString returns NULL diff --git a/postgis/lwgeom_in_gml.c b/postgis/lwgeom_in_gml.c index 1a045b6e7..ab0046bc3 100644 --- a/postgis/lwgeom_in_gml.c +++ b/postgis/lwgeom_in_gml.c @@ -1168,6 +1168,10 @@ static LWGEOM* parse_gml_polygon(xmlNodePtr xnode, bool *hasz, int *root_srid) } } + /* Found an or but no rings?!? We're outa here! */ + if ( ! ppa ) + gml_lwerror("invalid GML representation", 43); + for (ring=1, xa = xnode->children ; xa != NULL ; xa = xa->next) { /* Polygon/innerBoundaryIs -> GML 2.1.2 */ diff --git a/regress/tickets.sql b/regress/tickets.sql index 9008a8e69..ec791def6 100644 --- a/regress/tickets.sql +++ b/regress/tickets.sql @@ -680,6 +680,40 @@ with inp as ( SELECT -- #1799 -- SELECT '#1799', ST_Segmentize('LINESTRING(0 0, 10 0)'::geometry, 0); +-- #1936 -- +select st_astext(st_geomfromgml( + ' + + + + + 711540.35 1070163.61 711523.82 1070166.54 711521.30 1070164.14 711519.52 1070162.44 711518.57 1070164.62 712154.47 1070824.94 + + + + + + 712154.47 1070824.94 712154.98 1070826.04 712154.41 1070827.22 + + + + + + + 712154.41 1070827.22 712160.31 1070837.07 712160.92 1070835.36 712207.89 1071007.95 + + + + 712207.89 1071007.95 712207.48 1071005.59 712208.38 1071001.28712208.38 1071001.28 712228.74 1070949.67 712233.98 1070936.15 712124.93 1070788.72712124.93 1070788.72 712124.28 1070785.87 712124.63 1070783.38712124.63 1070783.38 712141.04 1070764.12 712146.60 1070757.01 711540.35 1070163.61 + + + 713061.62 1070354.46 713053.59 1070335.12 713049.58 1070315.92 713049.65 1070298.33 713061.62 1070354.46 + + + ')); + -- #1957 -- SELECT '#1957', ST_Distance(ST_Makeline(ARRAY['POINT(1 0)'::geometry]), 'POINT(0 0)'::geometry); diff --git a/regress/tickets_expected b/regress/tickets_expected index d8cd736c9..fe3f74af6 100644 --- a/regress/tickets_expected +++ b/regress/tickets_expected @@ -220,4 +220,5 @@ NOTICE: SRID value -1 converted to the officially unknown SRID value 0 #1776|POLYGON((0 0,10 0,10 10,0 0))|POLYGON((0 0,10 0,10 10,0 0)) #1791|4.7 ERROR: ST_Segmentize: invalid max_distance 0 (must be >= 0) +ERROR: invalid GML representation #1957|1