[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0alpha1-129-gb163027d

git at osgeo.org git at osgeo.org
Tue Jun 9 07:34:46 PDT 2020


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  b163027dc1aa015e94d9a0e0181c797376a83cbe (commit)
      from  957ee5d51b17d5d5f841311976c2a94e8c557aa8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b163027dc1aa015e94d9a0e0181c797376a83cbe
Author: Regina Obe <lr at pcorp.us>
Date:   Tue Jun 9 10:22:56 2020 -0400

    Fix for raster crash. References #4699 - Jaime Casanova (2nd Quadrant)

diff --git a/NEWS b/NEWS
index ea49e53..6f112e8 100644
--- a/NEWS
+++ b/NEWS
@@ -77,6 +77,7 @@ PostGIS 3.1.0alpha1
   - #4600, Improve precision of ST_TileEnvelope (Raúl Marín)
   - #4608, PG12: Fix several bugs in the index support function (Raúl Marín)
   - #4621, Prevent stack overflow when parsing WKB (Raúl Marín)
+  - #4699, crash on null input to ST_Union(raster, otherarg) (Jaime Casanova)
 
 * Deprecated signatures *
   - Function postgis_svn_version() replaced by postgis_lib_revision()
diff --git a/raster/rt_pg/rtpg_mapalgebra.c b/raster/rt_pg/rtpg_mapalgebra.c
index d771a48..be183b8 100644
--- a/raster/rt_pg/rtpg_mapalgebra.c
+++ b/raster/rt_pg/rtpg_mapalgebra.c
@@ -2891,8 +2891,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) {
diff --git a/raster/test/regress/rt_union.sql b/raster/test/regress/rt_union.sql
index a64b23a..fb93ae0 100644
--- a/raster/test/regress/rt_union.sql
+++ b/raster/test/regress/rt_union.sql
@@ -457,3 +457,5 @@ 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);
+--#4699 crash
+SELECT 'null-1', ST_Union(null::raster,1);
diff --git a/raster/test/regress/rt_union_expected b/raster/test/regress/rt_union_expected
index 51cc3e3..699b9df 100644
--- a/raster/test/regress/rt_union_expected
+++ b/raster/test/regress/rt_union_expected
@@ -627,3 +627,4 @@ LAST|2|9|4
 LAST|3|9|4
 none|
 null|
+null-1|

-----------------------------------------------------------------------

Summary of changes:
 NEWS                                  | 1 +
 raster/rt_pg/rtpg_mapalgebra.c        | 5 ++++-
 raster/test/regress/rt_union.sql      | 2 ++
 raster/test/regress/rt_union_expected | 1 +
 4 files changed, 8 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list