]> granicus.if.org Git - postgis/commitdiff
Fix memory error in MultiPolygon GeoJson parsing (#2130)
authorSandro Santilli <strk@keybit.net>
Mon, 3 Dec 2012 16:19:04 +0000 (16:19 +0000)
committerSandro Santilli <strk@keybit.net>
Mon, 3 Dec 2012 16:19:04 +0000 (16:19 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@10786 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/lwgeom_in_geojson.c
regress/tickets.sql
regress/tickets_expected

index d3970da432e049bf07c4d604223b656ae332619b..f42202e668cdc2238a10ea49b1494efa6f20d622 100644 (file)
@@ -376,7 +376,7 @@ parse_geojson_multipolygon(json_object *geojson, bool *hasz,  int *root_srid)
                                {
                                        int nPoints;
                                        ppa = (POINTARRAY**) lwrealloc((POINTARRAY *) ppa, sizeof(POINTARRAY*) * (j + 1));
-                                       ppa[i] = ptarray_construct_empty(1, 0, 1);
+                                       ppa[j] = ptarray_construct_empty(1, 0, 1);
                                        points = json_object_array_get_idx( poObjPoly, j );
 
                                        nPoints = json_object_array_length( points );
index bb050b03f25a1c6489171bd4e5461e0af6b3a78a..d902cf18edbe318648d3a17bb7e7bf61bb462165 100644 (file)
@@ -791,5 +791,7 @@ FROM (SELECT 'POLYGON((1 1 1, 5 1 1,5 5 1, 1 5 1,1 1 1))'::geometry as a, 'LINES
 SELECT '#2108', ST_AsEWKT(ST_Line_Interpolate_Point('SRID=3395;LINESTRING M EMPTY'::geometry, 0.5));
 SELECT '#2117', ST_AsEWKT(ST_PointOnSurface('SRID=3395;MULTIPOLYGON M EMPTY'::geometry));
 
+SELECT '#2130', ST_NPoints(ST_GeomFromGeoJSON('{"type":"MultiPolygon","coordinates":[[[[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,32],[-117,32],[-117,32],[-117,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-117,32],[-117,32],[-117,32],[-117,32]],[[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,32],[-117,33]]]]}'));
+
 -- Clean up
 DELETE FROM spatial_ref_sys;
index e0f691fa23b992aaf783b3aa3e2cd2f86ccb07d6..e7f22f88bed46731944b20da8902f5b0e0d09f79 100644 (file)
@@ -242,3 +242,4 @@ ERROR:  invalid GML representation
 #2112b|1|LINESTRING(1 1 1,1 0 1)
 #2108|SRID=3395;POINTM EMPTY
 #2117|SRID=3395;POINTM EMPTY
+#2130|8