[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0alpha1-63-gb6b33b0

git at osgeo.org git at osgeo.org
Tue Apr 21 08:08:41 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, master has been updated
       via  b6b33b0dc65025a11993b42899cd94db8a25eb04 (commit)
      from  c83c3dfdc123b9ca42d6ba3d520ca086c241966a (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 b6b33b0dc65025a11993b42899cd94db8a25eb04
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
    
    References #4670
    Introduced in #4599, so backpatching through 2.5

diff --git a/NEWS b/NEWS
index 8659b46..94ed614 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,7 @@ Only tickets not included in 3.1.0alpha1
 * Bug fixes *
   - #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 3.1.0alpha1
 2020/02/01
diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c
index 4d0daa2..6fc2803 100644
--- a/postgis/lwgeom_functions_basic.c
+++ b/postgis/lwgeom_functions_basic.c
@@ -2252,9 +2252,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/core/tickets.sql b/regress/core/tickets.sql
index 4e1b3e0..842bd07 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1288,3 +1288,10 @@ select '#4399', 'ST_AsGeoJSON', ST_AsGeoJSON(geom)::text from geom;
 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/core/tickets_expected b/regress/core/tickets_expected
index 4b34ba7..fbf9316 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -427,3 +427,9 @@ ERROR:  BOX2D_construct: args can not be empty points
 #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                             | 1 +
 postgis/lwgeom_functions_basic.c | 6 +++++-
 regress/core/tickets.sql         | 7 +++++++
 regress/core/tickets_expected    | 6 ++++++
 4 files changed, 19 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list