[SCM] PostGIS branch stable-3.4 updated. 3.4.1-10-g342d74200

git at osgeo.org git at osgeo.org
Fri Dec 1 08:17:22 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.4 has been updated
       via  342d74200ff38e00c383068cd4a2387f10eaf981 (commit)
       via  60672a77d6dc9fbcfea398e5f28136eedf37dd38 (commit)
      from  ad9032dc180e0fd6342849a314b21bf4c8dd2214 (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 342d74200ff38e00c383068cd4a2387f10eaf981
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Fri Dec 1 08:09:42 2023 -0800

    News entry for #5629

diff --git a/NEWS b/NEWS
index c83af47e0..857c5b274 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ To take advantage of all SFCGAL featurs, SFCGAL 1.4.1+ is needed.
  - #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)
 
 
 * Bug Fixes and Enhancments *

commit 60672a77d6dc9fbcfea398e5f28136eedf37dd38
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 6f2eb9764..6a1ec79cd 100644
--- a/liblwgeom/lwgeom.c
+++ b/liblwgeom/lwgeom.c
@@ -1575,7 +1575,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
@@ -1587,7 +1592,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
@@ -1650,6 +1660,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++)
@@ -1658,6 +1669,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)
@@ -1673,6 +1685,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               |  1 +
 liblwgeom/lwgeom.c | 27 +++++++++++++++++++++++++--
 2 files changed, 26 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list