[SCM] PostGIS branch master updated. 3.5.0-370-g9630344e4
git at osgeo.org
git at osgeo.org
Thu Jun 5 00:51:33 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 9630344e480fb0dcb6e0e3e97269b26b0cf27a3a (commit)
from d3222fc117d4becd97c4185e3339c7a8eb03cbfa (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 9630344e480fb0dcb6e0e3e97269b26b0cf27a3a
Author: Sandro Santilli <strk at kbt.io>
Date: Thu Jun 5 09:15:12 2025 +0200
Fix crash on TopoGeo_addLineString(empty)
References #5922 in master branch (3.6.0dev)
diff --git a/liblwgeom/topo/lwgeom_topo.c b/liblwgeom/topo/lwgeom_topo.c
index 6d938d5b6..c1e09eb1a 100644
--- a/liblwgeom/topo/lwgeom_topo.c
+++ b/liblwgeom/topo/lwgeom_topo.c
@@ -7128,6 +7128,12 @@ _lwt_AddLine(LWT_TOPOLOGY* topo, LWLINE* line, double tol, int* nedges,
int input_was_closed = 0;
POINT4D originalStartPoint;
+ if ( lwline_is_empty(line) )
+ {
+ *nedges = 0;
+ return NULL;
+ }
+
if ( lwline_is_closed(line) )
{
input_was_closed = 1;
diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index 01c8b98a2..4d13fbeb9 100644
--- a/topology/postgis_topology.c
+++ b/topology/postgis_topology.c
@@ -5105,6 +5105,13 @@ Datum TopoGeo_AddLinestring(PG_FUNCTION_ARGS)
PG_RETURN_NULL();
}
}
+ /* Nothing to do if line is empty */
+ if ( lwline_is_empty(ln) )
+ {
+ lwgeom_free(lwgeom);
+ PG_FREE_IF_COPY(geom, 1);
+ PG_RETURN_NULL();
+ }
tol = PG_GETARG_FLOAT8(2);
if ( tol < 0 )
diff --git a/topology/test/regress/topogeo_addlinestring.sql b/topology/test/regress/topogeo_addlinestring.sql
index 79bdc4b84..1b35ba150 100644
--- a/topology/test/regress/topogeo_addlinestring.sql
+++ b/topology/test/regress/topogeo_addlinestring.sql
@@ -58,6 +58,7 @@ $$ LANGUAGE 'plpgsql';
SELECT 'invalid', TopoGeo_addLineString('city_data', 'SRID=4326;MULTILINESTRING((36 26, 38 30))');
SELECT 'invalid', TopoGeo_addLineString('city_data', 'SRID=4326;POINT(36 26)');
SELECT 'invalid', TopoGeo_addLineString('invalid', 'SRID=4326;LINESTRING(36 26, 0 0)');
+SELECT 'empty', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING EMPTY');
-- Isolated edge in universal face
SELECT 'iso_uni', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(36 26, 38 30)');
diff --git a/topology/test/regress/topogeo_addlinestring_expected b/topology/test/regress/topogeo_addlinestring_expected
index 9b6efe509..6757356c1 100644
--- a/topology/test/regress/topogeo_addlinestring_expected
+++ b/topology/test/regress/topogeo_addlinestring_expected
@@ -3,6 +3,7 @@ max|edge|26
ERROR: Invalid geometry type (MULTILINESTRING) passed to TopoGeo_AddLinestring, expected LINESTRING
ERROR: Invalid geometry type (POINT) passed to TopoGeo_AddLinestring, expected LINESTRING
ERROR: No topology with name "invalid" in topology.topology
+empty|
iso_uni|27
iso_uni|N||POINT(36 26)
iso_uni|N||POINT(38 30)
-----------------------------------------------------------------------
Summary of changes:
liblwgeom/topo/lwgeom_topo.c | 6 ++++++
topology/postgis_topology.c | 7 +++++++
topology/test/regress/topogeo_addlinestring.sql | 1 +
topology/test/regress/topogeo_addlinestring_expected | 1 +
4 files changed, 15 insertions(+)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list