[SCM] PostGIS branch master updated. 3.6.0rc2-497-g7318e9522
git at osgeo.org
git at osgeo.org
Thu Jun 4 13:45:30 PDT 2026
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 7318e95222b33f24eb606e958eb48fcfef06411f (commit)
from f09adbed379aad9ed9374cd19ca7ec3b6c2c0b49 (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 7318e95222b33f24eb606e958eb48fcfef06411f
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Thu Jun 4 13:45:12 2026 -0700
Avoid Inf looping and memory use in ST_Split
When fed with very large coordinates, ST_Split could be
fooled into an Inf loop, this fixes that case,
closes #5916
diff --git a/liblwgeom/lwgeom_geos_split.c b/liblwgeom/lwgeom_geos_split.c
index a69b3d502..15ca6ff5c 100644
--- a/liblwgeom/lwgeom_geos_split.c
+++ b/liblwgeom/lwgeom_geos_split.c
@@ -282,9 +282,12 @@ lwline_split_by_point_to(const LWLINE* lwline_in, const LWPOINT* blade_in,
LWDEBUGF(3, "Projected point:(%.15g %.15g), seg:%d, p1:(%.15g %.15g), p2:(%.15g %.15g)", pt_projected.x, pt_projected.y, seg, p1.x, p1.y, p2.x, p2.y);
- /* When closest point == an endpoint, this is a boundary intersection */
- if ( ( (seg == nsegs-1) && P4D_SAME_STRICT(&pt_projected, &p2) ) ||
- ( (seg == 0) && P4D_SAME_STRICT(&pt_projected, &p1) ) )
+ /* When closest point == an endpoint, this is a boundary intersection.
+ * Compare only X and Y since pt_projected.x/y were forced to pt.x/y above,
+ * and Z/M may be NaN when line coordinates are very large (causing Inf/Inf
+ * in closest_point_on_segment). See #5916. */
+ if ( ( (seg == nsegs-1) && (pt_projected.x == p2.x) && (pt_projected.y == p2.y) ) ||
+ ( (seg == 0) && (pt_projected.x == p1.x) && (pt_projected.y == p1.y) ) )
{
return 1;
}
diff --git a/regress/core/split.sql b/regress/core/split.sql
index a1087e171..3b82a6708 100644
--- a/regress/core/split.sql
+++ b/regress/core/split.sql
@@ -114,4 +114,8 @@ SELECT '#5635a', ST_Split('LINESTRING Z (1 2 NaN,3 4 10,5 6 NaN)'::geometry
-- https://trac.osgeo.org/postgis/ticket/5635 (split by nan blade)
SELECT '#5635b', ST_Split('LINESTRING Z (1 2 1,3 4 10,5 6 3)'::geometry
,'MULTIPOINT(1 NaN,2 1,2 4, 4 5)'::geometry);
+-- https://trac.osgeo.org/postgis/ticket/5916 (split hangs on huge-but-finite coordinates)
+SELECT '#5916', ST_NumGeometries(ST_Split(
+ ST_GeomFromText('LINESTRING(123456789 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999, 0 1)'),
+ ST_GeomFromText('MULTIPOINT(0 1, 0 0, 2 3)')));
-- TODO: split line by collapsed line
diff --git a/regress/core/split_expected b/regress/core/split_expected
index 62ec3cfeb..9e5be98a0 100644
--- a/regress/core/split_expected
+++ b/regress/core/split_expected
@@ -31,3 +31,4 @@ ERROR: Splitter line has linear intersection with input
87|SRID=4326;GEOMETRYCOLLECTION(LINESTRING EMPTY)
ERROR: Input Geometry contains invalid coordinates
ERROR: Blade Geometry contains invalid coordinates
+#5916|1
-----------------------------------------------------------------------
Summary of changes:
liblwgeom/lwgeom_geos_split.c | 9 ++++++---
regress/core/split.sql | 4 ++++
regress/core/split_expected | 1 +
3 files changed, 11 insertions(+), 3 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list