[postgis-tickets] r14920 - #3565, st_setpoint crashes database
Paul Ramsey
pramsey at cleverelephant.ca
Wed May 25 10:28:32 PDT 2016
Author: pramsey
Date: 2016-05-25 10:28:32 -0700 (Wed, 25 May 2016)
New Revision: 14920
Modified:
branches/2.2/NEWS
branches/2.2/postgis/lwgeom_functions_basic.c
branches/2.2/regress/tickets.sql
branches/2.2/regress/tickets_expected
Log:
#3565, st_setpoint crashes database
Modified: branches/2.2/NEWS
===================================================================
--- branches/2.2/NEWS 2016-05-25 17:28:25 UTC (rev 14919)
+++ branches/2.2/NEWS 2016-05-25 17:28:32 UTC (rev 14920)
@@ -6,6 +6,7 @@
- #3524, Add interruptibility to geography brute-force distance
calculation
- #3522, Handle POINT and MULTIPOINT correctly in ST_Subdivide
+ - #3565, ST_SetPoint can crash backend
PostGIS 2.2.2
Modified: branches/2.2/postgis/lwgeom_functions_basic.c
===================================================================
--- branches/2.2/postgis/lwgeom_functions_basic.c 2016-05-25 17:28:25 UTC (rev 14919)
+++ branches/2.2/postgis/lwgeom_functions_basic.c 2016-05-25 17:28:32 UTC (rev 14920)
@@ -2265,6 +2265,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.2/regress/tickets.sql
===================================================================
--- branches/2.2/regress/tickets.sql 2016-05-25 17:28:25 UTC (rev 14919)
+++ branches/2.2/regress/tickets.sql 2016-05-25 17:28:32 UTC (rev 14920)
@@ -947,5 +947,8 @@
SELECT '#3470', ST_Polygonize(ARRAY[NULL]::geometry[]) IS NULL;
SELECT '#3470b', ST_Area(ST_Polygonize(ARRAY[NULL, 'LINESTRING (0 0, 10 0, 10 10)', NULL, 'LINESTRING (0 0, 10 10)', NULL]::geometry[]));
+-- #3565
+SELECT '#3565',ST_SetPoint(st_geomfromtext('LINESTRING EMPTY'), 0, ST_MakePoint(1,1));
+
-- Clean up
DELETE FROM spatial_ref_sys;
Modified: branches/2.2/regress/tickets_expected
===================================================================
--- branches/2.2/regress/tickets_expected 2016-05-25 17:28:25 UTC (rev 14919)
+++ branches/2.2/regress/tickets_expected 2016-05-25 17:28:32 UTC (rev 14920)
@@ -291,3 +291,4 @@
#3437e|5
#3470|t
#3470b|50
+ERROR: Cannot set point values on EMPTY geometry, use ST_AddPoint to add points
More information about the postgis-tickets
mailing list