[SCM] PostGIS branch stable-3.2 updated. 3.2.7-48-g8c4c2abfb
git at osgeo.org
git at osgeo.org
Fri Jul 25 01:35:13 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 8c4c2abfb225f16fecfcc8d6e7749945a257aeac (commit)
from 16a2ac1ad850b3d953878741aa1bc3ae790c59e9 (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 8c4c2abfb225f16fecfcc8d6e7749945a257aeac
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.2 branch (3.2.9dev)
Includes regress test
diff --git a/NEWS b/NEWS
index 5761d39f0..3d64558e1 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Proj 4.9+ required.
* Bug Fixes *
+ - #5951, [topology] Fix crash in ST_GetFaceEdges with corrupted topology (Sandro Santilli)
- #5947, [topology] Fix crash in ST_ModEdgeHeal (Sandro Santilli)
- #5925, #5946, [topology] Have GetFaceContainingPoint survive EMPTY edges (Sandro Santilli)
- #5922, [topology] Fix crash in TopoGeo_AddLinestring with EMPTY input (Sandro Santilli)
diff --git a/liblwgeom/lwgeom_topo.c b/liblwgeom/lwgeom_topo.c
index 8a52e6d53..88817eac1 100644
--- a/liblwgeom/lwgeom_topo.c
+++ b/liblwgeom/lwgeom_topo.c
@@ -3122,6 +3122,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 %"PRIu64" edges", face_id, numfaceedges);
return -1;
}
diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index 2379463ad..8d608564a 100644
--- a/topology/postgis_topology.c
+++ b/topology/postgis_topology.c
@@ -4104,6 +4104,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');
diff --git a/topology/test/regress/st_getfaceedges_expected b/topology/test/regress/st_getfaceedges_expected
index 08d619f6f..e4c929206 100644
--- a/topology/test/regress/st_getfaceedges_expected
+++ b/topology/test/regress/st_getfaceedges_expected
@@ -38,4 +38,4 @@ t
#3265.6|2|(1,1)
#3265.6|2|(2,-2)
#3265.6|2|(3,3)
-Topology 'tt' dropped
+ERROR: Corrupted topology: unable to build geometry of face 1 from its 2 edges
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
liblwgeom/lwgeom_topo.c | 2 ++
topology/postgis_topology.c | 4 ++++
topology/test/regress/st_getfaceedges.sql | 13 ++++++++++++-
topology/test/regress/st_getfaceedges_expected | 2 +-
5 files changed, 20 insertions(+), 2 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list