[SCM] PostGIS branch stable-3.5 updated. 3.5.3-33-gc81b55d6a
git at osgeo.org
git at osgeo.org
Sat Jul 19 00:58:40 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.5 has been updated
via c81b55d6a9dec0b97e86cfde1eca429bc0f397df (commit)
from f8b2f26d551b09c15e3945fdbdab4be86bdebb26 (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 c81b55d6a9dec0b97e86cfde1eca429bc0f397df
Author: Sandro Santilli <strk at kbt.io>
Date: Sat Jul 19 09:47:42 2025 +0200
Have GetFaceContainingPoint catch EMPTY edges in corrupted topology
Fixes #5925, #5946 in 3.5 branch (3.5.4dev)
Includes regression test
diff --git a/NEWS b/NEWS
index fa06b7ad5..e5f6233c4 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ PostgreSQL 12-18 required. GEOS 3.8+ required. Proj 6.1+ required.
* Bug fixes *
+- #5925, #5946, [topology] Have GetFaceContainingPoint survive EMPTY edges (Sandro Santilli)
- #5936, [topology] Do script-based upgrade in a single transaction (Sandro Santilli)
- #5908, [topology] Fix crash in GetFaceContainingPoint (Sandro Santilli)
- #5907, [topology] Fix crash in TopoGeo_AddPolygon with EMPTY input (Sandro Santilli)
diff --git a/liblwgeom/topo/lwgeom_topo.c b/liblwgeom/topo/lwgeom_topo.c
index feb818f93..c25833ed2 100644
--- a/liblwgeom/topo/lwgeom_topo.c
+++ b/liblwgeom/topo/lwgeom_topo.c
@@ -7732,6 +7732,14 @@ lwt_GetFaceContainingPoint(LWT_TOPOLOGY* topo, const LWPOINT* pt)
return -1;
}
+ if ( closestEdge->geom->points->npoints < 2 )
+ {
+ lwerror("Corrupted topology: geometry of edge %" LWTFMT_ELEMID " is EMPTY",
+ closestEdge->edge_id);
+ _lwt_release_edges(closestEdge, 1);
+ return -1;
+ }
+
LWDEBUGGF(2, lwline_as_lwgeom(closestEdge->geom), "Closest edge %" LWTFMT_ELEMID, closestEdge->edge_id);
/* Find closest segment of edge to the point */
diff --git a/topology/test/regress/getfacebypoint.sql b/topology/test/regress/getfacebypoint.sql
index ea4cb32e5..71962e4e1 100644
--- a/topology/test/regress/getfacebypoint.sql
+++ b/topology/test/regress/getfacebypoint.sql
@@ -57,4 +57,11 @@ SELECT 'e1', topology.GetFaceByPoint('topo','POINT(1 5)', 0);
-- Ask for a Point with a tolerance too high (2 or more faces)
SELECT 'e2', topology.GetFaceByPoint('topo','POINT(6 13)', 1);
+-- Empty edge geometries should not make the function choke
+-- See https://trac.osgeo.org/postgis/ticket/5946
+BEGIN;
+UPDATE topo.edge_data SET geom = 'LINESTRING EMPTY';
+SELECT 't5946', topology.GetFaceByPoint('topo','POINT(6 13)', 0);
+ROLLBACK;
+
SELECT NULL FROM topology.DropTopology('topo');
diff --git a/topology/test/regress/getfacebypoint_expected b/topology/test/regress/getfacebypoint_expected
index 5dfc9116f..471eeafd7 100644
--- a/topology/test/regress/getfacebypoint_expected
+++ b/topology/test/regress/getfacebypoint_expected
@@ -10,3 +10,4 @@ t4|0
t5|t
ERROR: Two or more faces found
ERROR: Two or more faces found
+ERROR: Corrupted topology: geometry of edge 9 is EMPTY
diff --git a/topology/test/regress/topogeo_addpoint.sql b/topology/test/regress/topogeo_addpoint.sql
index a454cc711..2d8325ca4 100644
--- a/topology/test/regress/topogeo_addpoint.sql
+++ b/topology/test/regress/topogeo_addpoint.sql
@@ -86,3 +86,11 @@ SELECT NULL FROM topology.TopoGeo_addLinestring('t', 'LINESTRING(0 0, 10 0)');
SELECT 't5794', 'N', topology.TopoGeo_addPoint('t', 'POINT(9 5)', 5);
SELECT 't5794', 'V', * FROM ValidateTopology('t');
ROLLBACK;
+
+-- See https://trac.osgeo.org/postgis/ticket/5925
+BEGIN;
+SELECT NULL FROM topology.CreateTopology ('t');
+SELECT NULL FROM topology.TopoGeo_addLinestring('t', 'LINESTRING(0 0, 10 0)');
+UPDATE t.edge_data SET geom = 'LINESTRING EMPTY';
+SELECT 't5925.1', topology.TopoGeo_addPoint('t', 'POINT(5 5)', 0);
+ROLLBACK;
diff --git a/topology/test/regress/topogeo_addpoint_expected b/topology/test/regress/topogeo_addpoint_expected
index 727560e08..b4aa3f69f 100644
--- a/topology/test/regress/topogeo_addpoint_expected
+++ b/topology/test/regress/topogeo_addpoint_expected
@@ -33,3 +33,4 @@ tt5394|N|3
t5698|E|1
t5698|N|3
t5794|N|3
+ERROR: Corrupted topology: geometry of edge 1 is EMPTY
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
liblwgeom/topo/lwgeom_topo.c | 8 ++++++++
topology/test/regress/getfacebypoint.sql | 7 +++++++
topology/test/regress/getfacebypoint_expected | 1 +
topology/test/regress/topogeo_addpoint.sql | 8 ++++++++
topology/test/regress/topogeo_addpoint_expected | 1 +
6 files changed, 26 insertions(+)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list