[SCM] PostGIS branch stable-3.2 updated. 3.2.6-12-gce0ff1f96

git at osgeo.org git at osgeo.org
Mon Dec 4 11:06:35 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, stable-3.2 has been updated
       via  ce0ff1f9649dde67a589fe40a6b214eea0b443a9 (commit)
       via  b41fb7fa411a13733b18503884614b0b038b530d (commit)
       via  f554feef52006ba34022959a6152dce633e03ada (commit)
       via  78414fa1d15f9c4b05c72013f26c5fc9b9f60b6e (commit)
      from  5305d138167aced9f8d4925b8dd34e8231842d91 (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 ce0ff1f9649dde67a589fe40a6b214eea0b443a9
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Dec 4 09:49:05 2023 -0800

    News item for #5635

diff --git a/NEWS b/NEWS
index 702e220d2..613539f66 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ Proj 6.1+, and PostgreSQL 14+.
  - #5627, Handling of EMPTY components in PiP check (Paul Ramsey)
  - #5629, Handling EMPTY components in repeated point removal (Paul Ramsey)
  - #5604, Handle distance between collections with empty elements (Paul Ramsey)
+ - #5635, Handle NaN points in ST_Split (Regina Obe)
 
 
 PostGIS 3.2.6

commit b41fb7fa411a13733b18503884614b0b038b530d
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 75d99c847..743efb694 100644
--- a/postgis/lwgeom_geos.c
+++ b/postgis/lwgeom_geos.c
@@ -3268,6 +3268,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

commit f554feef52006ba34022959a6152dce633e03ada
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Fri Dec 1 15:44:44 2023 -0800

    News item for #5604

diff --git a/NEWS b/NEWS
index a16295ce1..702e220d2 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Proj 6.1+, and PostgreSQL 14+.
           in ST_SetPoint (Regina Obe)
  - #5627, Handling of EMPTY components in PiP check (Paul Ramsey)
  - #5629, Handling EMPTY components in repeated point removal (Paul Ramsey)
+ - #5604, Handle distance between collections with empty elements (Paul Ramsey)
 
 
 PostGIS 3.2.6

commit 78414fa1d15f9c4b05c72013f26c5fc9b9f60b6e
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Fri Dec 1 15:32:28 2023 -0800

    Correctly handle distances between collections with empty elements, references #5604

diff --git a/liblwgeom/measures.c b/liblwgeom/measures.c
index 6ee9e3426..2484e9d16 100644
--- a/liblwgeom/measures.c
+++ b/liblwgeom/measures.c
@@ -299,7 +299,7 @@ lw_dist2d_recursive(const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS *dl)
 			g1 = (LWGEOM *)lwg1;
 
 		if (lwgeom_is_empty(g1))
-			return LW_TRUE;
+			continue;
 
 		if (lw_dist2d_is_collection(g1))
 		{
@@ -329,10 +329,9 @@ lw_dist2d_recursive(const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS *dl)
 			if (!g2->bbox)
 				lwgeom_add_bbox(g2);
 
-			/* If one of geometries is empty, return. True here only means continue searching. False would
-			 * have stopped the process*/
+			/* If one of geometries is empty, skip */
 			if (lwgeom_is_empty(g1) || lwgeom_is_empty(g2))
-				return LW_TRUE;
+				continue;
 
 			if ((dl->mode != DIST_MAX) && (!lw_dist2d_check_overlap(g1, g2)) &&
 			    (g1->type == LINETYPE || g1->type == POLYGONTYPE || g1->type == TRIANGLETYPE) &&
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index e1cf15380..e56c17ae5 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1469,3 +1469,12 @@ FROM (VALUES
     ('MULTIPOLYGON(((-357 477,-392 574,-378 574,-357 477)))'::geometry),
     ('MULTIPOLYGON(((-357 477,-392 574,-378 574,-357 477)))'::geometry))
     AS geoms(geom);
+
+SELECT '#5604',
+ ST_Distance(a2, a1),
+ ST_AsText(ST_ClosestPoint(a2, a1)),
+ ST_Distance(a1, a2),
+ ST_AsText(ST_ClosestPoint(a1, a2))
+FROM
+ST_GeomFromText('MULTIPOINT((-2 0), EMPTY)') AS a1,
+ST_GeomFromText('MULTIPOINT((1 0),(0 0))') AS a2;
diff --git a/regress/core/tickets_expected b/regress/core/tickets_expected
index f9055e9ae..76d0e588e 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -463,3 +463,4 @@ ERROR:  Geometry contains invalid coordinates
 ERROR:  Geometry contains invalid coordinates
 #5378|4269
 #5627|t
+#5604|2|POINT(0 0)|2|POINT(-2 0)

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

Summary of changes:
 NEWS                          |  2 ++
 liblwgeom/measures.c          |  7 +++----
 postgis/lwgeom_geos.c         | 13 +++++++++++++
 regress/core/split.sql        |  7 +++++++
 regress/core/split_expected   |  2 ++
 regress/core/tickets.sql      |  9 +++++++++
 regress/core/tickets_expected |  1 +
 7 files changed, 37 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list