]> granicus.if.org Git - postgis/commitdiff
#2704, ST_DumpPoints of EMPTY geometries crashes server
authorPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 7 Apr 2014 14:44:44 +0000 (14:44 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 7 Apr 2014 14:44:44 +0000 (14:44 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@12430 b70326c6-7e19-0410-871a-916f4a2858ee

NEWS
postgis/lwgeom_dumppoints.c
regress/dumppoints.sql

diff --git a/NEWS b/NEWS
index b914c3131aaf24d8168e0c62ba5c684050cda934..f98b0a84201b8e9a5550fd1d38ede5688bc50d36 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -58,6 +58,7 @@ PostGIS 2.2.0
   - #2556, geography ST_Intersects results depending on insert order
   - #2634, regression in sphere distance code
   - #2697, invalid GeoJSON Polygon input crashes server process
+  - #2704, ST_DumpPoints of EMPTY geometries crashes server
 
 
  * Code refactoring *
index 17fb2c601e23e73817825ecee6e58ee1ba5a86b8..c26d514c86ea146dfe19931d36f10965a2fd8fdf 100644 (file)
@@ -74,6 +74,7 @@ Datum LWGEOM_dumppoints(PG_FUNCTION_ARGS) {
 
                /* return early if nothing to do */
                if (!lwgeom || lwgeom_is_empty(lwgeom)) {
+                       MemoryContextSwitchTo(oldcontext);
                        funcctx = SRF_PERCALL_SETUP();
                        SRF_RETURN_DONE(funcctx);
                }
index 8ad24ded1fdecce45cd6a3b8ed357d17c564dfe6..8e6fa540e939fe0cd65287a7cf5da9c35a92f700 100644 (file)
@@ -177,3 +177,9 @@ FROM (
 SELECT 'CURVEPOLYGON(CIRCULARSTRING(0 0, 4 0, 4 4, 0 4, 0 0),(1 1, 3 3, 3 1, 1 1))'::geometry as geom
 ) as g
 ) j;
+
+SELECT '#2704', ST_DumpPoints('POLYGON EMPTY'::geometry);
+SELECT '#2704', ST_DumpPoints('MULTIPOLYGON EMPTY'::geometry);
+SELECT '#2704', ST_DumpPoints('MULTILINESTRING EMPTY'::geometry);
+SELECT '#2704', ST_DumpPoints('LINESTRING EMPTY'::geometry);
+SELECT '#2704', ST_DumpPoints('GEOMETRYCOLLECTION EMPTY'::geometry);