[postgis-tickets] r17177 - Avoid passing a NULL pointer to GEOSisEmpty
Raul
raul at rmr.ninja
Fri Jan 18 08:07:59 PST 2019
Author: algunenano
Date: 2019-01-18 08:07:59 -0800 (Fri, 18 Jan 2019)
New Revision: 17177
Modified:
branches/2.3/NEWS
branches/2.3/liblwgeom/lwgeom_geos_clean.c
branches/2.3/liblwgeom/lwgeom_geos_cluster.c
Log:
Avoid passing a NULL pointer to GEOSisEmpty
Closes #4275
Closes https://github.com/postgis/postgis/pull/362
Modified: branches/2.3/NEWS
===================================================================
--- branches/2.3/NEWS 2019-01-18 16:06:56 UTC (rev 17176)
+++ branches/2.3/NEWS 2019-01-18 16:07:59 UTC (rev 17177)
@@ -11,6 +11,7 @@
- #4267, Enable Proj 6 deprecated APIs (Darafei Praliaskouski, Raúl Marín)
+ - #4275, Avoid passing a NULL pointer to GEOSisEmpty (Raúl Marín)
PostGIS 2.3.8
2018/11/24
Modified: branches/2.3/liblwgeom/lwgeom_geos_clean.c
===================================================================
--- branches/2.3/liblwgeom/lwgeom_geos_clean.c 2019-01-18 16:06:56 UTC (rev 17176)
+++ branches/2.3/liblwgeom/lwgeom_geos_clean.c 2019-01-18 16:07:59 UTC (rev 17177)
@@ -698,10 +698,13 @@
const GEOSGeometry* g = GEOSGetGeometryN(gin, i);
GEOSGeometry* vg;
vg = LWGEOM_GEOS_makeValidLine(g);
- if ( GEOSisEmpty(vg) )
+ /* Drop any invalid or empty geometry */
+ if (!vg)
+ continue;
+ if (GEOSisEmpty(vg))
{
- /* we don't care about this one */
GEOSGeom_destroy(vg);
+ continue;
}
if ( GEOSGeomTypeId(vg) == GEOS_POINT )
{
@@ -960,7 +963,7 @@
pd = GEOSDifference(pi, po); /* input points - output points */
GEOSGeom_destroy(pi);
GEOSGeom_destroy(po);
- loss = !GEOSisEmpty(pd);
+ loss = pd && !GEOSisEmpty(pd);
GEOSGeom_destroy(pd);
if ( loss )
{
Modified: branches/2.3/liblwgeom/lwgeom_geos_cluster.c
===================================================================
--- branches/2.3/liblwgeom/lwgeom_geos_cluster.c 2019-01-18 16:06:56 UTC (rev 17176)
+++ branches/2.3/liblwgeom/lwgeom_geos_cluster.c 2019-01-18 16:07:59 UTC (rev 17177)
@@ -178,7 +178,7 @@
{
const GEOSPreparedGeometry* prep = NULL;
- if (GEOSisEmpty(geoms[p]))
+ if (!geoms[p] || GEOSisEmpty(geoms[p]))
continue;
cxt.num_items_found = 0;
More information about the postgis-tickets
mailing list