[SCM] PostGIS branch master updated. 3.4.0rc1-830-g8f77e8a6b

git at osgeo.org git at osgeo.org
Sun Dec 3 14:10:18 PST 2023


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  8f77e8a6b2bc26d8cb77daa221f6edda20aa3f04 (commit)
      from  4338f0b59c47d651347564c74003598b4c55b8c1 (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 8f77e8a6b2bc26d8cb77daa221f6edda20aa3f04
Author: Regina Obe <lr at pcorp.us>
Date:   Sun Dec 3 17:09:26 2023 -0500

    Prevent NaN and infinite coordinates
    in input and blade geometries of ST_Split
    References #5635 for PostGIS 3.5.0

diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c
index dc6aab8e9..4371eb7b3 100644
--- a/postgis/lwgeom_geos.c
+++ b/postgis/lwgeom_geos.c
@@ -3368,6 +3368,19 @@ Datum ST_Split(PG_FUNCTION_ARGS)
 	lwgeom_in = lwgeom_from_gserialized(in);
 	lwblade_in = lwgeom_from_gserialized(blade_in);
 
+	if (!lwgeom_isfinite(lwgeom_in))
+	{
+		lwpgerror("Input Geometry contains invalid coordinates");
+		PG_RETURN_NULL();
+	}
+
+	if (!lwgeom_isfinite(lwblade_in))
+	{
+		lwpgerror("Blade Geometry contains invalid coordinates");
+		PG_RETURN_NULL();
+	}
+
+
 	lwgeom_out = lwgeom_split(lwgeom_in, lwblade_in);
 	lwgeom_free(lwgeom_in);
 	lwgeom_free(lwblade_in);
diff --git a/regress/core/split.sql b/regress/core/split.sql
index 2374026cc..a1087e171 100644
--- a/regress/core/split.sql
+++ b/regress/core/split.sql
@@ -107,4 +107,11 @@ select '86', ST_AsEWKT(ST_Split(
 select '87', ST_AsEWKT(ST_Split('SRID=4326;LINESTRING EMPTY', 'SRID=4326;POINT(0 1)'));
 
 
+-- https://trac.osgeo.org/postgis/ticket/5635 (split by nan input)
+SELECT '#5635a', ST_Split('LINESTRING Z (1 2 NaN,3 4 10,5 6 NaN)'::geometry
+					,'MULTIPOINT(EMPTY,2 1,2 4, 4 5)'::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);
 -- TODO: split line by collapsed line
diff --git a/regress/core/split_expected b/regress/core/split_expected
index b8a5287e9..62ec3cfeb 100644
--- a/regress/core/split_expected
+++ b/regress/core/split_expected
@@ -29,3 +29,5 @@ ERROR:  Splitter line has linear intersection with input
 85|SRID=3;GEOMETRYCOLLECTION(LINESTRING(1 -2,1 -1),LINESTRING(1 -1,1 1,3 1),LINESTRING(3 1,4 1))
 86|SRID=3;GEOMETRYCOLLECTION(LINESTRING(8 0,10 0),LINESTRING(0 0,5 0),LINESTRING(5 0,8 0),LINESTRING(5 0,5 5),LINESTRING(5 -2,5 0),LINESTRING(5 -5,5 -2),LINESTRING(8 20,10 20),LINESTRING(2 20,5 20),LINESTRING(0 20,2 20),LINESTRING(5 20,8 20))
 87|SRID=4326;GEOMETRYCOLLECTION(LINESTRING EMPTY)
+ERROR:  Input Geometry contains invalid coordinates
+ERROR:  Blade Geometry contains invalid coordinates

-----------------------------------------------------------------------

Summary of changes:
 postgis/lwgeom_geos.c       | 13 +++++++++++++
 regress/core/split.sql      |  7 +++++++
 regress/core/split_expected |  2 ++
 3 files changed, 22 insertions(+)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list