[postgis-tickets] [SCM] PostGIS branch stable-2.5 updated. 2.5.6-3-gfdd03bcbe
git at osgeo.org
git at osgeo.org
Sun Jul 17 13:36:38 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-2.5 has been updated
via fdd03bcbe1543bf780fdae361c274d782b3320a8 (commit)
from 260e4b6e7a105033962b9b460e7b47ed9bde16ba (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 fdd03bcbe1543bf780fdae361c274d782b3320a8
Author: Regina Obe <lr at pcorp.us>
Date: Sun Jul 17 15:03:15 2022 -0400
garden crash ST_SetPoint with empty geometries
References #5151 for PostGIS 2.5.7
diff --git a/NEWS b/NEWS
index 1ab0f634f..669d85b89 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PostGIS 2.5.7dev
* Bug fixes *
+ - #5151, ST_SetPoint with empty geometries (Regina Obe)
- #5152, Fix infinite loop with ST_Split (Sandro Santilli)
PostGIS 2.5.6
diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c
index c05ab0acc..5001a0d76 100644
--- a/postgis/lwgeom_functions_basic.c
+++ b/postgis/lwgeom_functions_basic.c
@@ -2310,6 +2310,12 @@ 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 */
which = which + line->points->npoints ;
diff --git a/regress/tickets.sql b/regress/tickets.sql
index aac984a74..d01e1fe9a 100644
--- a/regress/tickets.sql
+++ b/regress/tickets.sql
@@ -1126,3 +1126,6 @@ SELECT '#4670-2', ST_AsEWKT(ST_AddPoint('LINESTRING(0 0, 1 1, 3 3, 4 4)'::geomet
SELECT '#4670-3', ST_AsEWKT(ST_AddPoint('LINESTRING(0 0, 1 1, 3 3, 4 4)'::geometry, 'POINT(2 2)'::geometry, 3));
SELECT '#4670-4', ST_AsEWKT(ST_AddPoint('LINESTRING(0 0, 1 1, 3 3, 4 4)'::geometry, 'POINT(2 2)'::geometry, 4));
SELECT '#4670-5', ST_AsEWKT(ST_AddPoint('LINESTRING(0 0, 1 1, 3 3, 4 4)'::geometry, 'POINT(2 2)'::geometry, 5));
+
+-- 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/tickets_expected b/regress/tickets_expected
index 88e3525f0..32a91f94b 100644
--- a/regress/tickets_expected
+++ b/regress/tickets_expected
@@ -345,3 +345,4 @@ NOTICE: table "bug_4144_table" does not exist, skipping
#4670-3|LINESTRING(0 0,1 1,3 3,2 2,4 4)
#4670-4|LINESTRING(0 0,1 1,3 3,4 4,2 2)
ERROR: LWGEOM_addpoint: Invalid offset
+ERROR: Line has no points
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
postgis/lwgeom_functions_basic.c | 6 ++++++
regress/tickets.sql | 3 +++
regress/tickets_expected | 1 +
4 files changed, 11 insertions(+)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list