[postgis-tickets] r14918 - #3565, st_setpoint crashes database
Paul Ramsey
pramsey at cleverelephant.ca
Wed May 25 10:28:18 PDT 2016
Author: pramsey
Date: 2016-05-25 10:28:18 -0700 (Wed, 25 May 2016)
New Revision: 14918
Modified:
branches/2.0/NEWS
branches/2.0/postgis/lwgeom_functions_basic.c
branches/2.0/regress/tickets.sql
branches/2.0/regress/tickets_expected
Log:
#3565, st_setpoint crashes database
Modified: branches/2.0/NEWS
===================================================================
--- branches/2.0/NEWS 2016-05-25 00:56:30 UTC (rev 14917)
+++ branches/2.0/NEWS 2016-05-25 17:28:18 UTC (rev 14918)
@@ -21,6 +21,7 @@
- #3436, memory handling mistake in ptarray_clone_deep
- #3461, ST_GeomFromKML crashes Postgres when there are
innerBoundaryIs and no outerBoundaryIs
+ - #3565, ST_SetPoint can crash backend
PostGIS 2.0.7
Modified: branches/2.0/postgis/lwgeom_functions_basic.c
===================================================================
--- branches/2.0/postgis/lwgeom_functions_basic.c 2016-05-25 00:56:30 UTC (rev 14917)
+++ branches/2.0/postgis/lwgeom_functions_basic.c 2016-05-25 17:28:18 UTC (rev 14918)
@@ -2287,6 +2287,11 @@
elog(ERROR, "First argument must be a LINESTRING");
PG_RETURN_NULL();
}
+ if ( lwgeom_is_empty(lwg) )
+ {
+ elog(ERROR, "Cannot set point values on EMPTY geometry, use ST_AddPoint to add points");
+ PG_RETURN_NULL();
+ }
if ( which > line->points->npoints-1 )
{
elog(ERROR, "Point index out of range (%d..%d)", 0, line->points->npoints-1);
Modified: branches/2.0/regress/tickets.sql
===================================================================
--- branches/2.0/regress/tickets.sql 2016-05-25 00:56:30 UTC (rev 14917)
+++ branches/2.0/regress/tickets.sql 2016-05-25 17:28:18 UTC (rev 14918)
@@ -774,5 +774,8 @@
SELECT '#2870', ST_Summary('Point(151.215289 -33.856885)'::geometry::bytea::geography);
+-- #3565
+SELECT '#3565',ST_SetPoint(st_geomfromtext('LINESTRING EMPTY'), 0, ST_MakePoint(1,1));
+
-- Clean up
DELETE FROM spatial_ref_sys;
Modified: branches/2.0/regress/tickets_expected
===================================================================
--- branches/2.0/regress/tickets_expected 2016-05-25 00:56:30 UTC (rev 14917)
+++ branches/2.0/regress/tickets_expected 2016-05-25 17:28:18 UTC (rev 14918)
@@ -244,3 +244,4 @@
#2427|POINT(-1 0)
#2168|5340.76237395|5340.76237395|0
#2870|Point[G]
+ERROR: Cannot set point values on EMPTY geometry, use ST_AddPoint to add points
More information about the postgis-tickets
mailing list