From: Daniel Baston Date: Mon, 4 Sep 2017 17:42:11 +0000 (+0000) Subject: #3829, Crash in LWGEOM2GEOS X-Git-Tag: 2.4.0rc1~71 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eaa7695c5b564931605e2c09d8b9830c53071b25;p=postgis #3829, Crash in LWGEOM2GEOS git-svn-id: http://svn.osgeo.org/postgis/trunk@15621 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/cunit/cu_geos.c b/liblwgeom/cunit/cu_geos.c index 85df9541e..322069011 100644 --- a/liblwgeom/cunit/cu_geos.c +++ b/liblwgeom/cunit/cu_geos.c @@ -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)) )", }; diff --git a/liblwgeom/lwgeom_geos.c b/liblwgeom/lwgeom_geos.c index 558b6d7b6..8d84ed519 100644 --- a/liblwgeom/lwgeom_geos.c +++ b/liblwgeom/lwgeom_geos.c @@ -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; }