[SCM] PostGIS branch stable-3.3 updated. 3.3.7-47-g505716588

git at osgeo.org git at osgeo.org
Fri Jul 25 01:00:07 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.3 has been updated
       via  505716588163b63d175ab8c40070f63979181e1d (commit)
      from  e714fb6c150bfffa721fa6d0168363a1b96adb81 (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 505716588163b63d175ab8c40070f63979181e1d
Author: Sandro Santilli <strk at kbt.io>
Date:   Fri Jul 25 09:37:39 2025 +0200

    Fix crash in ST_GetFaceEdges with corrupted topology
    
    References #5951 in 3.3 branch (3.3.9dev)

diff --git a/NEWS b/NEWS
index 14e573861..8a642a757 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Proj 4.9+ required.
 
 * Bug Fixes and Enhancements *
 
+ - #5951, [topology] Fix crash in ST_GetFaceEdges with corrupted topology (Sandro Santilli)
  - #5947, [topology] Fix crash in ST_ModEdgeHeal (Sandro Santilli)
  - #5922, [topology] Fix crash in TopoGeo_AddLinestring with EMPTY input (Sandro Santilli)
  - #5908, [topology] Fix crash in GetFaceContainingPoint (Sandro Santilli)
diff --git a/liblwgeom/lwgeom_topo.c b/liblwgeom/lwgeom_topo.c
index 6234d6035..80daa4524 100644
--- a/liblwgeom/lwgeom_topo.c
+++ b/liblwgeom/lwgeom_topo.c
@@ -3130,6 +3130,8 @@ lwt_GetFaceEdges(LWT_TOPOLOGY* topo, LWT_ELEMID face_id, LWT_ELEMID **out )
   {
     /* _lwt_FaceByEdges should have already invoked lwerror in this case */
     _lwt_release_edges(edges, numfaceedges);
+    lwerror("Corrupted topology: unable to build geometry of face %"
+      LWTFMT_ELEMID " from its %llu edges", face_id, numfaceedges);
     return -1;
   }
 
diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index 2b31cabe4..7acff22f9 100644
--- a/topology/postgis_topology.c
+++ b/topology/postgis_topology.c
@@ -4220,6 +4220,10 @@ Datum ST_GetFaceEdges(PG_FUNCTION_ARGS)
 
   /* get state */
   state = funcctx->user_fctx;
+  if ( ! state )
+  {
+    SRF_RETURN_DONE(funcctx);
+  }
 
   if ( state->curr == state->nelems )
   {
diff --git a/topology/test/regress/st_getfaceedges.sql b/topology/test/regress/st_getfaceedges.sql
index 6ff65b468..356ba1faf 100644
--- a/topology/test/regress/st_getfaceedges.sql
+++ b/topology/test/regress/st_getfaceedges.sql
@@ -41,4 +41,15 @@ SELECT '#3265.3', 'E'||topology.TopoGeo_addLinestring('tt',
 SELECT '#3265.4', 0, ST_GetFaceEdges('tt', 0);
 SELECT '#3265.5', 1, ST_GetFaceEdges('tt', 1);
 SELECT '#3265.6', 2, ST_GetFaceEdges('tt', 2);
-SELECT topology.DropTopology('tt');
+SELECT NULL FROM topology.DropTopology('tt');
+
+-- See https://trac.osgeo.org/postgis/ticket/5951
+SELECT NULL FROM topology.CreateTopology('t5951');
+SELECT NULL FROM topology.TopoGeo_addLinestring('t5951', 'LINESTRING(0 0, 10 0)');
+SELECT NULL FROM topology.TopoGeo_addLinestring('t5951', 'LINESTRING(0 0, 5 5)');
+SELECT NULL FROM topology.TopoGeo_addLinestring('t5951', 'LINESTRING(5 5, 10 0)');
+SELECT NULL FROM topology.TopoGeo_addLinestring('t5951', 'LINESTRING(5 5, 10 5)');
+SELECT NULL FROM topology.TopoGeo_addLinestring('t5951', 'LINESTRING(10 0, 10 5)');
+UPDATE t5951.edge_data SET left_face = 0, right_face = 0 WHERE edge_id = 3;
+SELECT '#5951.1', topology.ST_GetFaceEdges('t5951', face_id) FROM t5951.face WHERE face_id > 0;
+SELECT NULL FROM topology.DropTopology('t5951');

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

Summary of changes:
 NEWS                                      |  1 +
 liblwgeom/lwgeom_topo.c                   |  2 ++
 topology/postgis_topology.c               |  4 ++++
 topology/test/regress/st_getfaceedges.sql | 13 ++++++++++++-
 4 files changed, 19 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list