[SCM] PostGIS branch stable-3.1 updated. 3.1.11-18-g4682e8cc9

git at osgeo.org git at osgeo.org
Wed Apr 9 08:33:33 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.1 has been updated
       via  4682e8cc95e835f483c545d988df7f086acf5b95 (commit)
      from  11d600b2bedbd26244444c8bf1aa917fe336f70e (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 4682e8cc95e835f483c545d988df7f086acf5b95
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Apr 9 08:33:29 2025 -0700

    Fix ST_AddPoint with empty point argument, references #5876

diff --git a/NEWS b/NEWS
index cb81ed186..eb7f96642 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,11 @@
 PostGIS 3.1.13dev
 YYYY/MM/DD
 
+* Bug Fixes *
+
+ - #5876, Fix ST_AddPoint with empty point argument (Paul Ramsey)
+
+
 PostGIS 3.1.12
 2024/12/23
 
diff --git a/liblwgeom/lwgeom_api.c b/liblwgeom/lwgeom_api.c
index 313a767aa..81181dc96 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 )
 	{
-		lwnotice("%s [%d] called with n=%d and npoints=%d", __FILE__, __LINE__, n, pa->npoints);
+		lerror("%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 8d6e4decf..ef0ca419d 100644
--- a/postgis/lwgeom_functions_basic.c
+++ b/postgis/lwgeom_functions_basic.c
@@ -2215,6 +2215,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)

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

Summary of changes:
 NEWS                             | 5 +++++
 liblwgeom/lwgeom_api.c           | 5 +++--
 postgis/lwgeom_functions_basic.c | 5 +++++
 3 files changed, 13 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list