[postgis-tickets] r17176 - Avoid passing a NULL pointer to GEOSisEmpty
Raul
raul at rmr.ninja
Fri Jan 18 08:06:57 PST 2019
Author: algunenano
Date: 2019-01-18 08:06:56 -0800 (Fri, 18 Jan 2019)
New Revision: 17176
Modified:
branches/2.4/NEWS
branches/2.4/liblwgeom/lwgeom_geos_clean.c
branches/2.4/liblwgeom/lwgeom_geos_cluster.c
Log:
Avoid passing a NULL pointer to GEOSisEmpty
References #4275
Modified: branches/2.4/NEWS
===================================================================
--- branches/2.4/NEWS 2019-01-18 16:06:14 UTC (rev 17175)
+++ branches/2.4/NEWS 2019-01-18 16:06:56 UTC (rev 17176)
@@ -12,6 +12,7 @@
- #4290, More robust distance calculations in geography (Paul Ramsey)
- #4292, ST_AsMVT: parse JSON numeric values with decimals as doubles (Raúl Marín)
- #4289, ST_AsMVTGeom: Transform coordinates space before clipping (Raúl Marín)
+ - #4275, Avoid passing a NULL pointer to GEOSisEmpty (Raúl Marín)
PostGIS 2.4.6
Modified: branches/2.4/liblwgeom/lwgeom_geos_clean.c
===================================================================
--- branches/2.4/liblwgeom/lwgeom_geos_clean.c 2019-01-18 16:06:14 UTC (rev 17175)
+++ branches/2.4/liblwgeom/lwgeom_geos_clean.c 2019-01-18 16:06:56 UTC (rev 17176)
@@ -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.4/liblwgeom/lwgeom_geos_cluster.c
===================================================================
--- branches/2.4/liblwgeom/lwgeom_geos_cluster.c 2019-01-18 16:06:14 UTC (rev 17175)
+++ branches/2.4/liblwgeom/lwgeom_geos_cluster.c 2019-01-18 16:06:56 UTC (rev 17176)
@@ -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