[SCM] PostGIS branch stable-3.3 updated. 3.3.5-9-g917077620
git at osgeo.org
git at osgeo.org
Fri Dec 1 08:24:56 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.3 has been updated
via 9170776205f59d14f9db219232dcf79fb91890ef (commit)
via 321b285dec7cbc5894333b406c2752122f18a8a5 (commit)
from 4db3ea514a07771bab69500ab2a330aa5a5829f4 (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 9170776205f59d14f9db219232dcf79fb91890ef
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri Dec 1 08:14:13 2023 -0800
News entry for #5629
diff --git a/NEWS b/NEWS
index c80e86181..bd4ac005a 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Proj 6.1+, and PostgreSQL 15+.
- #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.3.5
commit 321b285dec7cbc5894333b406c2752122f18a8a5
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 c4e2e33ac..4edf4d630 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