[SCM] PostGIS branch stable-3.4 updated. 3.4.4-6-g5932f54a0
git at osgeo.org
git at osgeo.org
Mon Apr 7 12:44:03 PDT 2025
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 5932f54a0bbcca89b805a75f45c4f4805ea734ac (commit)
from 1362852443693e6d21b2aa9c74f5c14bdbc097c1 (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 5932f54a0bbcca89b805a75f45c4f4805ea734ac
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Mon Apr 7 12:43:54 2025 -0700
Fix ST_AddPoint with empty point argument
References #5876
diff --git a/NEWS b/NEWS
index c20a1d818..e46da072c 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ Proj 6.1+ required.
- #5564, BRIN crash fix and support for parallel in PG17+
(Paul Ramsey, Regina Obe)
+ - #5876, Fix ST_AddPoint with empty point argument
PostGIS 3.4.4
diff --git a/liblwgeom/lwgeom_api.c b/liblwgeom/lwgeom_api.c
index 43e5d374b..db5516b7d 100644
--- a/liblwgeom/lwgeom_api.c
+++ b/liblwgeom/lwgeom_api.c
@@ -108,7 +108,8 @@ POINT4D
getPoint4d(const POINTARRAY *pa, uint32_t n)
{
POINT4D result;
- getPoint4d_p(pa, n, &result);
+ if (getPoint4d_p(pa, n, &result) == 0)
+ lwerror("%s [%d] error returned by getPoint4d_p", __FILE__, __LINE__);
return result;
}
@@ -135,7 +136,7 @@ getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *op)
if ( n>=pa->npoints )
{
- LWDEBUGF(2, "%s [%d] called with n=%d and npoints=%d", __FILE__, __LINE__, n, pa->npoints);
+ lwerror("%s [%d] called with n=%d and npoints=%d", __FILE__, __LINE__, n, pa->npoints);
return 0;
}
diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c
index b00a71d6a..03a0fc49b 100644
--- a/postgis/lwgeom_functions_basic.c
+++ b/postgis/lwgeom_functions_basic.c
@@ -2330,6 +2330,11 @@ Datum LWGEOM_addpoint(PG_FUNCTION_ARGS)
PG_RETURN_NULL();
}
+ if (gserialized_is_empty(pglwg2))
+ {
+ PG_RETURN_POINTER(pglwg1);
+ }
+
line = lwgeom_as_lwline(lwgeom_from_gserialized(pglwg1));
if (PG_NARGS() <= 2)
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index e211686c1..a6a0d447e 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1546,3 +1546,7 @@ SELECT '#5647' AS ticket,
'coveredby_mixed_empty ' || ST_CoveredBy(mixedemptypt, poly),
'covers_mixed_empty ' || ST_Covers(poly, mixedemptypt)
FROM g, generate_series(1,2);
+
+SELECT '#5876', ST_AsText(ST_AddPoint(
+ 'LINESTRING (1 1, 2 2)'::geometry,
+ 'POINT EMPTY'::geometry), 2);
diff --git a/regress/core/tickets_expected b/regress/core/tickets_expected
index 65c7b2993..af989311b 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -472,3 +472,4 @@ ERROR: Geometry contains invalid coordinates
#5604|2|POINT(0 0)|2|POINT(-2 0)
#5647|intersects_empty false|within_empty false|contains_empty false|coveredby_empty false|covers_empty false|intersects_mixed_empty true|within_mixed_empty false|contains_mixed_empty false|coveredby_mixed_empty true|covers_mixed_empty true
#5647|intersects_empty false|within_empty false|contains_empty false|coveredby_empty false|covers_empty false|intersects_mixed_empty true|within_mixed_empty false|contains_mixed_empty false|coveredby_mixed_empty true|covers_mixed_empty true
+#5876|LINESTRING(1 1,2 2)
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
liblwgeom/lwgeom_api.c | 5 +++--
postgis/lwgeom_functions_basic.c | 5 +++++
regress/core/tickets.sql | 4 ++++
regress/core/tickets_expected | 1 +
5 files changed, 14 insertions(+), 2 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list