Commit 9e895546 authored by Raúl Marín's avatar Raúl Marín

Avoid passing a NULL pointer to GEOSisEmpty

References #4275


git-svn-id: http://svn.osgeo.org/postgis/branches/2.5@17175 b70326c6-7e19-0410-871a-916f4a2858ee
parent c1e1f0a3
Pipeline #43906243 passed with stage
in 22 minutes and 39 seconds
......@@ -38,6 +38,7 @@ XXXX/XX/XX
- #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.5.1
2018/11/18
......
......@@ -573,11 +573,15 @@ LWGEOM_GEOS_makeValidMultiLine(const GEOSGeometry* gin)
const GEOSGeometry* g = GEOSGetGeometryN(gin, i);
GEOSGeometry* vg;
vg = LWGEOM_GEOS_makeValidLine(g);
/* 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)
points[npoints++] = vg;
else if (GEOSGeomTypeId(vg) == GEOS_LINESTRING)
......@@ -827,7 +831,7 @@ LWGEOM_GEOS_makeValid(const GEOSGeometry* gin)
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)
{
......
......@@ -178,7 +178,7 @@ union_intersecting_pairs(GEOSGeometry** geoms, uint32_t num_geoms, UNIONFIND* uf
{
const GEOSPreparedGeometry* prep = NULL;
if (GEOSisEmpty(geoms[p]))
if (!geoms[p] || GEOSisEmpty(geoms[p]))
continue;
cxt.num_items_found = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment