[postgis-tickets] [SCM] PostGIS branch stable-2.5 updated. 2.5.4-10-g10318f5

git at osgeo.org git at osgeo.org
Tue Apr 21 08:33:16 PDT 2020


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  10318f524f6b099a2f5ea11842d288422c694c8e (commit)
      from  0b47e35a3184b8fb076bca78397ac6ba811659db (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 10318f524f6b099a2f5ea11842d288422c694c8e
Author: Raúl Marín <git at rmr.ninja>
Date:   Tue Apr 21 16:41:19 2020 +0200

    ST_AddPoint: Fix bug when a positive position is requested
    
    Closes #4670
    Introduced in #4599, so backpatching through 2.5

diff --git a/NEWS b/NEWS
index 4ab6497..f35ade2 100644
--- a/NEWS
+++ b/NEWS
@@ -5,7 +5,7 @@ PostGIS 2.5.5
 
   - #4652, Fix several memory related bugs in ST_GeomFromGML (Raúl Marín)
   - #4661, Fix access to spatial_ref_sys with a non default schema (Raúl Marín)
-
+  - #4670, ST_AddPoint: Fix bug when a positive position is requested (Raúl Marín)
 
 PostGIS 2.5.4
 2020/02/28
diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c
index 492c02f..c05ab0a 100644
--- a/postgis/lwgeom_functions_basic.c
+++ b/postgis/lwgeom_functions_basic.c
@@ -2200,9 +2200,13 @@ Datum LWGEOM_addpoint(PG_FUNCTION_ARGS)
 		}
 		else if (where < 0 || where > (int32)line->points->npoints)
 		{
-			elog(ERROR, "Invalid offset");
+			elog(ERROR, "%s: Invalid offset", __func__);
 			PG_RETURN_NULL();
 		}
+		else
+		{
+			uwhere = where;
+		}
 	}
 
 	point = lwgeom_as_lwpoint(lwgeom_from_gserialized(pglwg2));
diff --git a/regress/tickets.sql b/regress/tickets.sql
index 419b8fa..f5addc4 100644
--- a/regress/tickets.sql
+++ b/regress/tickets.sql
@@ -1119,3 +1119,10 @@ SELECT '#4176', ST_Intersects('POLYGON((0 0, 10 10, 3 5, 0 0))', 'GEOMETRYCOLLEC
 SELECT '#4599-1', ST_AsEWKT(ST_AddPoint(ST_GeomFromEWKT('LINESTRING(0 0 1, 1 1 1)'), ST_MakePoint(1, 2, 3)));
 SELECT '#4599-2', ST_AsEWKT(ST_AddPoint(ST_GeomFromEWKT('LINESTRING(0 0 1, 1 1 1)'), ST_MakePoint(1, 2, 3), 0));
 SELECT '#4599-3', ST_AsEWKT(ST_AddPoint(ST_GeomFromEWKT('LINESTRING(0 0 1, 1 1 1)'), ST_MakePoint(1, 2, 3), -1));
+
+SELECT '#4670-0', ST_AsEWKT(ST_AddPoint('LINESTRING(0 0, 1 1, 3 3, 4 4)'::geometry, 'POINT(2 2)'::geometry, 0));
+SELECT '#4670-1', ST_AsEWKT(ST_AddPoint('LINESTRING(0 0, 1 1, 3 3, 4 4)'::geometry, 'POINT(2 2)'::geometry, 1));
+SELECT '#4670-2', ST_AsEWKT(ST_AddPoint('LINESTRING(0 0, 1 1, 3 3, 4 4)'::geometry, 'POINT(2 2)'::geometry, 2));
+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));
\ No newline at end of file
diff --git a/regress/tickets_expected b/regress/tickets_expected
index 317bad8..cf76f6f 100644
--- a/regress/tickets_expected
+++ b/regress/tickets_expected
@@ -339,3 +339,9 @@ NOTICE:  table "bug_4144_table" does not exist, skipping
 #4599-1|LINESTRING(0 0 1,1 1 1,1 2 3)
 #4599-2|LINESTRING(1 2 3,0 0 1,1 1 1)
 #4599-3|LINESTRING(0 0 1,1 1 1,1 2 3)
+#4670-0|LINESTRING(2 2,0 0,1 1,3 3,4 4)
+#4670-1|LINESTRING(0 0,2 2,1 1,3 3,4 4)
+#4670-2|LINESTRING(0 0,1 1,2 2,3 3,4 4)
+#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

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

Summary of changes:
 NEWS                             | 2 +-
 postgis/lwgeom_functions_basic.c | 6 +++++-
 regress/tickets.sql              | 7 +++++++
 regress/tickets_expected         | 6 ++++++
 4 files changed, 19 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list