Opened 12 years ago

Closed 12 years ago

#1276 closed defect (fixed)

[raster] 2 band ST_MapAlgebraExpr crash

Reported by: robe Owned by: pracine
Priority: blocker Milestone: PostGIS 2.0.0
Component: raster Version: master
Keywords: Cc:

Description

Bborie,

Now I remember the input that I was able to use to make mapalebra crash.

--Create a cool set of rasters --
CREATE TABLE fun_shapes(rid serial PRIMARY KEY, fun_name text, rast raster);

-- Insert some cool shapes around Boston in Massachusetts state plane meters --
INSERT INTO fun_shapes(fun_name, rast)
VALUES ('ref', ST_AsRaster(ST_MakeEnvelope(235229, 899970, 237229, 901930,26986),200,200,'8BUI',0,0));

INSERT INTO fun_shapes(fun_name,rast)
WITH ref(rast) AS (SELECT rast FROM fun_shapes WHERE fun_name = 'ref' ) 
SELECT 'area' AS fun_name, ST_AsRaster(ST_Buffer(ST_SetSRID(ST_Point(236229, 900930),26986), 1000), 
			ref.rast,'8BUI', 118, 0) As rast
FROM ref
UNION ALL
SELECT 'rand bubbles', 
		 	ST_AsRaster( 
		 	(SELECT ST_Collect(geom)
	FROM (SELECT ST_Buffer(ST_SetSRID(ST_Point(236229 + i*random()*100, 900930 + j*random()*100),26986), random()*20) As geom
			FROM generate_series(1,10) As i, generate_series(1,10) As j
			) As foo ), ref.rast,'8BUI', 100, 0) 
FROM ref;

-- this works okay --
SELECT  st_mapalgebraexpr(
		area.rast, bub.rast, 'rast1', NULL, 'INTERSECTION') 
FROM 
  (SELECT rast FROM fun_shapes WHERE
 fun_name = 'area') As area
CROSS JOIN  (SELECT rast FROM fun_shapes WHERE
 fun_name = 'rand bubbles') As bub;

-- this crashes --
SELECT  st_mapalgebraexpr(
		area.rast, bub.rast, '((rast1*2 + rast2*18)/20.0)::integer', '8BUI', 'UNION', '0', 'rast1') 
FROM 
  (SELECT rast FROM fun_shapes WHERE
 fun_name = 'area') As area
CROSS JOIN  (SELECT rast FROM fun_shapes WHERE
 fun_name = 'rand bubbles') As bub

As far as I can tell its my constant '0' which is doing it.

Change History (2)

comment:1 by robe, 12 years ago

I'm guessing the 0 is being read as band 0 which is non-existent. If I change it to rast1*0 works fine.

comment:2 by Bborie Park, 12 years ago

Resolution: fixed
Status: newclosed
Summary: 2 band ST_MapAlgebraExpr crash[raster] 2 band ST_MapAlgebraExpr crash

Should be fixed in r8126

Note: See TracTickets for help on using tickets.