[SCM] PostGIS branch stable-3.2 updated. 3.2.6-8-g5305d1381

git at osgeo.org git at osgeo.org
Fri Dec 1 08:25:03 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  5305d138167aced9f8d4925b8dd34e8231842d91 (commit)
       via  d1bd88fe0b0fc21d84ee7116ebd2a14747ab1e0f (commit)
      from  6e8a1c9e6b6dcfdb37657a051af089a6e409e165 (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 5305d138167aced9f8d4925b8dd34e8231842d91
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Fri Dec 1 08:14:53 2023 -0800

    News entry for #5629

diff --git a/NEWS b/NEWS
index 04e587501..a16295ce1 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,8 @@ Proj 6.1+, and PostgreSQL 14+.
  - #5610, Regression fix: Allow Nan and infinity again
           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)
+
 
 PostGIS 3.2.6
 2023/11/19

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

    Fix crash on multipoint repeated point with empty, #5629

diff --git a/liblwgeom/lwgeom.c b/liblwgeom/lwgeom.c
index 4d0f96ef8..e9d6bc088 100644
--- a/liblwgeom/lwgeom.c
+++ b/liblwgeom/lwgeom.c
@@ -1558,7 +1558,12 @@ cmp_point_x(const void *pa, const void *pb)
 	const POINT2D *pt1 = getPoint2d_cp(p1->point, 0);
 	const POINT2D *pt2 = getPoint2d_cp(p2->point, 0);
 
-	return (pt1->x > pt2->x) ? 1 : ((pt1->x < pt2->x) ? -1 : 0);
+	if (pt1 && pt2)
+		return (pt1->x > pt2->x) ? 1 : ((pt1->x < pt2->x) ? -1 : 0);
+
+	if (pt1) return -1;
+	if (pt2) return 1;
+	return 0;
 }
 
 static int
@@ -1570,7 +1575,12 @@ cmp_point_y(const void *pa, const void *pb)
 	const POINT2D *pt1 = getPoint2d_cp(p1->point, 0);
 	const POINT2D *pt2 = getPoint2d_cp(p2->point, 0);
 
-	return (pt1->y > pt2->y) ? 1 : ((pt1->y < pt2->y) ? -1 : 0);
+	if (pt1 && pt2)
+		return (pt1->y > pt2->y) ? 1 : ((pt1->y < pt2->y) ? -1 : 0);
+
+	if (pt1) return -1;
+	if (pt2) return 1;
+	return 0;
 }
 
 int
@@ -1633,6 +1643,7 @@ lwgeom_remove_repeated_points_in_place(LWGEOM *geom, double tolerance)
 					continue;
 
 				const POINT2D *pti = getPoint2d_cp(mpt->geoms[i]->point, 0);
+				if (!pti) continue;
 
 				/* check upcoming points if they're within tolerance of current one */
 				for (uint32_t j = i + 1; j < mpt->ngeoms; j++)
@@ -1641,6 +1652,7 @@ lwgeom_remove_repeated_points_in_place(LWGEOM *geom, double tolerance)
 						continue;
 
 					const POINT2D *ptj = getPoint2d_cp(mpt->geoms[j]->point, 0);
+					if (!ptj) continue;
 
 					/* check that the point is in the strip of tolerance around the point */
 					if ((dim ? ptj->x - pti->x : ptj->y - pti->y) > tolerance)
@@ -1656,6 +1668,17 @@ lwgeom_remove_repeated_points_in_place(LWGEOM *geom, double tolerance)
 				}
 			}
 
+			/* null out empties */
+			for (uint32_t j = 0; j < mpt->ngeoms; j++)
+			{
+				if (mpt->geoms[j] && lwpoint_is_empty(mpt->geoms[j]))
+				{
+					lwpoint_free(mpt->geoms[j]);
+					mpt->geoms[j] = NULL;
+					geometry_modified = LW_TRUE;
+				}
+			}
+
 			/* compactify array of points */
 			uint32_t i = 0;
 			for (uint32_t j = 0; j < mpt->ngeoms; j++)

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

Summary of changes:
 NEWS               |  2 ++
 liblwgeom/lwgeom.c | 27 +++++++++++++++++++++++++--
 2 files changed, 27 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list