]> granicus.if.org Git - postgis/commitdiff
#3829, Crash in LWGEOM2GEOS
authorDaniel Baston <dbaston@gmail.com>
Mon, 4 Sep 2017 17:42:11 +0000 (17:42 +0000)
committerDaniel Baston <dbaston@gmail.com>
Mon, 4 Sep 2017 17:42:11 +0000 (17:42 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@15621 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/cunit/cu_geos.c
liblwgeom/lwgeom_geos.c

index 85df9541e76bc172a4a9668e9189cc39bd9f4d24..322069011ad5c5b4e86433046e10861d1442b545 100644 (file)
@@ -37,6 +37,7 @@ static void test_geos_noop(void)
                "SRID=100000;POLYGON((-1 -1 3,-1 2.5 3,2 2 3,2 -1 3,-1 -1 3),(0 0 3,0 1 3,1 1 3,1 0 3,0 0 3),(-0.5 -0.5 3,-0.5 -0.4 3,-0.4 -0.4 3,-0.4 -0.5 3,-0.5 -0.5 3))",
                "SRID=4326;MULTIPOLYGON(((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5)),((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5)))",
                "SRID=4326;GEOMETRYCOLLECTION(POINT(0 1),POLYGON((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0)),MULTIPOLYGON(((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5))))",
+               "GEOMETRYCOLLECTION( LINESTRING (1 1, 2 2), POINT EMPTY, TRIANGLE ((0 0, 1 0, 1 1, 0 0)) )",
        };
 
 
index 558b6d7b6071bdc352654dd058a7e995f9f02793..8d84ed51939d50a267c2df3ef99e83cac45be188 100644 (file)
@@ -458,7 +458,7 @@ LWGEOM2GEOS(const LWGEOM *lwgeom, int autofix)
                        g = LWGEOM2GEOS(lwc->geoms[i], 0);
                        if ( ! g )
                        {
-                               while (i) GEOSGeom_destroy(geoms[--i]);
+                               while (j) GEOSGeom_destroy(geoms[--j]);
                                free(geoms);
                                return NULL;
                        }