[SCM] PostGIS branch master updated. 3.5.0-476-g39304ca29
git at osgeo.org
git at osgeo.org
Sat Jul 19 00:49:20 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, master has been updated
via 39304ca29ac9e50327d0b5e5724596c05ded822d (commit)
from 7c47c79c09b2e5a0bf7f8b0d7b5b2f0bc1484f86 (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 39304ca29ac9e50327d0b5e5724596c05ded822d
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
Includes regression test
diff --git a/liblwgeom/topo/lwgeom_topo.c b/liblwgeom/topo/lwgeom_topo.c
index fc4b8122b..78b7b6dff 100644
--- a/liblwgeom/topo/lwgeom_topo.c
+++ b/liblwgeom/topo/lwgeom_topo.c
@@ -7715,6 +7715,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:
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 +
5 files changed, 25 insertions(+)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list