[postgis-tickets] [SCM] PostGIS branch stable-3.2 updated. 3.2.1-15-gb6e0fb902

git at osgeo.org git at osgeo.org
Tue May 17 15:54:41 PDT 2022


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  b6e0fb902d5d13fd01ec110adcf1cfabddedf7a7 (commit)
      from  ff3d4b65b49481505b341b0250e3d6811d0e1ebc (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 b6e0fb902d5d13fd01ec110adcf1cfabddedf7a7
Author: Regina Obe <lr at pcorp.us>
Date:   Tue May 17 18:53:00 2022 -0400

    Return error on ST_SetPoint emtpy linestring
    References #5151 for PostGIS 3.2.2

diff --git a/NEWS b/NEWS
index 8a0684710..db8de5ab9 100644
--- a/NEWS
+++ b/NEWS
@@ -15,7 +15,7 @@ PostGIS 3.2.2dev
   - #5091, Fix --without-protobuf builds (Tobias Bussmann)
   - #5100, Don't use pg_atoi (removed in PG15) (Laurenz Albe)
   - #5123, Support for PG15 (JSON funcs exposed) (Regina Obe)
-
+  - #5151, ST_SetPoint with empty geometries (Regina Obe)
 
 PostGIS 3.2.1
 2022/02/12
diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c
index 45265cee1..c9e7bdcc9 100644
--- a/postgis/lwgeom_functions_basic.c
+++ b/postgis/lwgeom_functions_basic.c
@@ -2449,6 +2449,10 @@ Datum LWGEOM_setpoint_linestring(PG_FUNCTION_ARGS)
 		elog(ERROR, "First argument must be a LINESTRING");
 		PG_RETURN_NULL();
 	}
+	if ( line->points->npoints < 1 ) 	{
+		elog(ERROR, "Line has no points");
+		PG_RETURN_NULL();
+	}
 	if (which < 0)
 	{
 		/* Use backward indexing for negative values */
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index 3c575bb8d..e1ca854c3 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1432,3 +1432,6 @@ SELECT
 	'#5008',
 	ST_DWithin('POINT EMPTY', 'POINT(0 0)', 'Inf'),
 	ST_DWithin('POINT(1 1)', 'POLYGON EMPTY', 'Inf');
+
+-- https://trac.osgeo.org/postgis/ticket/5151
+SELECT '#5151', ST_SetPoint(ST_GeomFromText('LINESTRING EMPTY',4326), 1, ST_GeomFromText('POINT(40 50)',4326)) As result;
diff --git a/regress/core/tickets_expected b/regress/core/tickets_expected
index 7cc2e9546..43c061191 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -460,3 +460,4 @@ ERROR:  LWGEOM_addpoint: Invalid offset
 #4770.c|MULTIPOINT(0 0,1 1)|602
 #4799|{"type": "Feature", "geometry": {"type":"Point","crs":{"type":"name","properties":{"name":"EPSG:25832"}},"coordinates":[359667,5651729]}, "properties": {"id": 1, "geom1": {"type":"Point","crs":{"type":"name","properties":{"name":"EPSG:3035"}},"coordinates":[4110471,3103061]}}}
 #5008|f|f
+ERROR:  Line has no points

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

Summary of changes:
 NEWS                             | 2 +-
 postgis/lwgeom_functions_basic.c | 4 ++++
 regress/core/tickets.sql         | 3 +++
 regress/core/tickets_expected    | 1 +
 4 files changed, 9 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list