Commit 3fac4814 authored by Sandro Santilli's avatar Sandro Santilli

Fix crash on null input to ST_Union(raster)

git-svn-id: http://svn.osgeo.org/postgis/trunk@12925 b70326c6-7e19-0410-871a-916f4a2858ee
parent 519ef7db
......@@ -2876,6 +2876,8 @@ Datum RASTER_union_finalfn(PG_FUNCTION_ARGS)
pfree(itrset);
rtpg_union_arg_destroy(iwr);
if (!_rtn) PG_RETURN_NULL();
pgraster = rt_raster_serialize(_rtn);
rt_raster_destroy(_rtn);
......
......@@ -424,6 +424,7 @@ INSERT INTO raster_union_in
SELECT 61, ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 1, -1, 0, 0, 0), 1, '8BUI', 2, 0) AS rast UNION ALL
SELECT 62, ST_AddBand(ST_MakeEmptyRaster(2, 2, 2, 0, 1, -1, 0, 0, 0), 1, '8BUI', 3, 0) AS rast UNION ALL
SELECT 63, ST_AddBand(ST_MakeEmptyRaster(2, 2, -1, -3, 1, -1, 0, 0, 0), 1, '8BUI', 4, 0) AS rast UNION ALL
SELECT 0, NULL::raster UNION ALL -- toxic element embedded
SELECT 64, ST_AddBand(ST_MakeEmptyRaster(2, 2, -2, 4, 1, -1, 0, 0, 0), 1, '8BUI', 5, 0) AS rast
;
......@@ -452,3 +453,7 @@ ORDER BY uniontype, y, x;
DROP TABLE IF EXISTS raster_union_in;
DROP TABLE IF EXISTS raster_union_out;
-- Some toxic input
SELECT 'none', ST_Union(r) from ( select null::raster r where false ) f;
SELECT 'null', ST_Union(null::raster);
......@@ -628,3 +628,5 @@ LAST|5|8|1
LAST|6|8|1
LAST|2|9|4
LAST|3|9|4
none|
null|
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment