[SCM] PostGIS branch stable-3.2 updated. 3.2.7-35-g25b708f66

git at osgeo.org git at osgeo.org
Thu May 29 01:11:37 PDT 2025


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, stable-3.2 has been updated
       via  25b708f667c6f10655d75eaa2b51eb3d051afe8e (commit)
      from  9f73023a13df8f7fa84ad9774db0967a6f134be5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 25b708f667c6f10655d75eaa2b51eb3d051afe8e
Author: Sandro Santilli <strk at kbt.io>
Date:   Thu May 29 10:03:10 2025 +0200

    Fix crash in TopoGeo_AddPolygon with EMPTY input
    
    References #5907 in 3.2 branch (3.2.9dev)

diff --git a/NEWS b/NEWS
index f9b45b536..1b125c45d 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Proj 4.9+ required.
 * Bug Fixes  *
 
  - #5908, [topology] Fix crash in GetFaceContainingPoint (Sandro Santilli)
+ - #5907, [topology] Fix crash in TopoGeo_AddPolygon with EMPTY input (Sandro Santilli)
  - #5876, Fix ST_AddPoint with empty point argument (Paul Ramsey)
  - #5818, GT-244 Fix CG_IsSolid function (Loïc Bartoletti)
  - #5885, Fix documentation about grid-based overlay operations (Sandro Santilli)
diff --git a/liblwgeom/lwgeom_topo.c b/liblwgeom/lwgeom_topo.c
index a84e250ca..7d621f305 100644
--- a/liblwgeom/lwgeom_topo.c
+++ b/liblwgeom/lwgeom_topo.c
@@ -6055,6 +6055,13 @@ lwt_AddPolygon(LWT_TOPOLOGY* topo, LWPOLY* poly, double tol, int* nfaces)
   const GEOSPreparedGeometry *ppoly;
   GEOSGeometry *polyg;
 
+  /* Nothing to add, in an empty polygon */
+  if ( lwpoly_is_empty(poly) )
+  {
+    *nfaces = 0;
+    return NULL;
+  }
+
   /* Get tolerance, if 0 was given */
   if ( ! tol ) tol = _LWT_MINTOLERANCE( topo, (LWGEOM*)poly );
   LWDEBUGF(1, "Working tolerance:%.15g", tol);
diff --git a/topology/test/regress/topogeo_addpolygon.sql b/topology/test/regress/topogeo_addpolygon.sql
index 68863b0b5..0cd58caad 100644
--- a/topology/test/regress/topogeo_addpolygon.sql
+++ b/topology/test/regress/topogeo_addpolygon.sql
@@ -19,7 +19,7 @@ DECLARE
   sql text;
 BEGIN
   -- Check effect on nodes
-  sql :=  'SELECT $1 || ''|N|'' ' || CASE WHEN add_id THEN ' || n.node_id || ''|'' ' ELSE '' END || ' || 
+  sql :=  'SELECT $1 || ''|N|'' ' || CASE WHEN add_id THEN ' || n.node_id || ''|'' ' ELSE '' END || ' ||
         COALESCE(n.containing_face::text,'''') || ''|'' ||
         ST_AsText(ST_SnapToGrid(n.geom, 0.2))::text as xx
   	FROM city_data.node n WHERE n.node_id > (
@@ -35,7 +35,7 @@ BEGIN
   -- Check effect on edges (there should be one split)
   sql := 'WITH node_limits AS ( SELECT max FROM city_data.limits WHERE what = ''node''::text ),
        edge_limits AS ( SELECT max FROM city_data.limits WHERE what = ''edge''::text )
-  SELECT $1 || ''|E|'' ' || CASE WHEN add_id THEN ' || e.edge_id || ''|sn'' || e.start_node || ''|en'' || e.end_node::text ' ELSE '' END || ' AS xx ' || 
+  SELECT $1 || ''|E|'' ' || CASE WHEN add_id THEN ' || e.edge_id || ''|sn'' || e.start_node || ''|en'' || e.end_node::text ' ELSE '' END || ' AS xx ' ||
    ' FROM city_data.edge e, node_limits nl, edge_limits el
    WHERE e.start_node > nl.max
       OR e.end_node > nl.max
@@ -72,6 +72,7 @@ $$ LANGUAGE 'plpgsql';
 SELECT 'invalid', TopoGeo_addPolygon('city_data', 'MULTILINESTRING((36 26, 38 30))');
 SELECT 'invalid', TopoGeo_addPolygon('city_data', 'POINT(36 26)');
 SELECT 'invalid', TopoGeo_addPolygon('invalid', 'POLYGON((36 26, 40 24, 40 30, 36 26))');
+SELECT 'empty', TopoGeo_addPolygon('city_data', 'POLYGON EMPTY');
 
 -- Isolated face in universal face
 SELECT 'iso_uni', TopoGeo_addPolygon('city_data', 'POLYGON((36 26, 38 30, 43 26, 36 26))');
@@ -145,11 +146,11 @@ SELECT 't1946.1', topology.topogeo_AddPolygon('bug1946',
           76.68727 30.74249,76.67933 30.75,
           76.69223 30.74157,76.68728 30.74248))'
 ::geometry);  **/
-SELECT 't1946.2', COUNT(*) 
+SELECT 't1946.2', COUNT(*)
   FROM topology.topogeo_AddPolygon('bug1946',
 'POLYGON((76.68728 30.74248,76.68727 30.74248,
           76.68727 30.74249,76.67933 30.75,
           76.69223 30.74157,76.68728 30.74248))'
-::geometry); 
+::geometry);
 
 SELECT 't1946.end', topology.DropTopology('bug1946');

-----------------------------------------------------------------------

Summary of changes:
 NEWS                                         | 1 +
 liblwgeom/lwgeom_topo.c                      | 7 +++++++
 topology/test/regress/topogeo_addpolygon.sql | 9 +++++----
 3 files changed, 13 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list