Opened 4 years ago
Closed 4 years ago
#4699 closed defect (fixed)
crash on null input to ST_Union(raster, otherarg)
Reported by: | jcasanov | Owned by: | robe |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.4.9 |
Component: | raster | Version: | 2.5.x -- EOL |
Keywords: | st_union raster null | Cc: | jcasanov |
Description
st_union() crash in any of the more-than-one argument variant.
select st_union(null::raster); -- does not fail select st_union(null::raster, 1); -- crash the server
attached is the backtrace of the query that crash, showed above
postgres version
PostgreSQL 12.3 (Debian 12.3-1.pgdg100+1) on x86_64-pc-linux-gnu,
compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
postgis full version
POSTGIS="2.5.4" [EXTENSION] PGSQL="120" GEOS="3.7.1-CAPI-1.11.1
27a5e771" PROJ="Rel. 5.2.0, September 15th, 2018" GDAL="GDAL 2.4.0, released 2018/12/14" LIBXML="2.9.4" LIBJSON="0.12.1" LIBPROTOBUF="1.3.1" RASTER
Attachments (1)
Change History (12)
by , 4 years ago
Attachment: | stack_trace_st_union_null_crash.txt added |
---|
comment:1 by , 4 years ago
This patch fixes the problem for me
diff --git a/raster/rt_pg/rtpg_mapalgebra.c b/raster/rt_pg/rtpg_mapalgebra.c index b3b6323cb..33ec63a80 100644 --- a/raster/rt_pg/rtpg_mapalgebra.c +++ b/raster/rt_pg/rtpg_mapalgebra.c @@ -2896,8 +2896,11 @@ Datum RASTER_union_finalfn(PG_FUNCTION_ARGS) PG_RETURN_NULL(); } } - else + else { _raster = iwr->bandarg[i].raster[0]; + if (_raster == NULL) + continue; + } /* first band, _rtn doesn't exist */ if (i < 1) {
comment:2 by , 4 years ago
Cc: | added |
---|
comment:4 by , 4 years ago
Owner: | changed from | to
---|
comment:6 by , 4 years ago
Milestone: | → PostGIS 2.4.9 |
---|
comment:11 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
stack trace of the crash