[SCM] PostGIS branch stable-3.3 updated. 3.3.7-2-gfbc9c5bb9

git at osgeo.org git at osgeo.org
Sun Sep 29 11:51:26 PDT 2024


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, stable-3.3 has been updated
       via  fbc9c5bb9bc6f8dbc3a4a732e8bedcfd06d49868 (commit)
      from  e035797e5ee5e940477b7480afa999d9ba11f9b1 (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 fbc9c5bb9bc6f8dbc3a4a732e8bedcfd06d49868
Author: Regina Obe <lr at pcorp.us>
Date:   Sun Sep 29 14:50:34 2024 -0400

    FIX for segfault in ST_MapAlgebra
    References #5785 for PostGIS 3.3.8
    Author: Dian M Fay

diff --git a/NEWS b/NEWS
index 99d994e78..dacc57dec 100644
--- a/NEWS
+++ b/NEWS
@@ -3,7 +3,8 @@ PostGIS 3.3.8
 
 * Bug Fixes and Enhancements *
 
- -
+ - #5785, [raster] ST_MapAlgebra segfaults when expression references
+          a supernumerary rast argument (Dian M Fay)
 
 
 PostGIS 3.3.7
diff --git a/doc/introduction.xml b/doc/introduction.xml
index c6171e3ad..4358895a0 100644
--- a/doc/introduction.xml
+++ b/doc/introduction.xml
@@ -248,6 +248,7 @@
 					<member>David Garnier</member>
 					<member>David Skea</member>
 					<member>David Techer</member>
+					<member>Dian M Fay</member>
 					<member>Dmitry Vasilyev</member>
 					<member>Eduin Carrillo</member>
 					<member>Eugene Antimirov</member>
diff --git a/raster/rt_pg/rtpg_mapalgebra.c b/raster/rt_pg/rtpg_mapalgebra.c
index 8af585978..87df4c9dd 100644
--- a/raster/rt_pg/rtpg_mapalgebra.c
+++ b/raster/rt_pg/rtpg_mapalgebra.c
@@ -1220,6 +1220,11 @@ static int rtpg_nmapalgebraexpr_callback(
 				if (idx < 1) continue;
 				idx--; /* 1-based now 0-based */
 
+				if (arg->rasters == 1 && i > 7) {
+					elog(ERROR, "rtpg_nmapalgebraexpr_callback: rast2 argument specified in single-raster invocation");
+					return 0;
+				}
+
 				switch (i) {
 					/* [rast.x] */
 					case 0:
diff --git a/raster/test/regress/rt_mapalgebra_expr.sql b/raster/test/regress/rt_mapalgebra_expr.sql
index 240deb85c..78f90bb21 100644
--- a/raster/test/regress/rt_mapalgebra_expr.sql
+++ b/raster/test/regress/rt_mapalgebra_expr.sql
@@ -128,6 +128,11 @@ SELECT ST_Value(rast, 1, 1),
     ST_Value(ST_MapAlgebra(rast, 1, NULL, '[rast]/0'), 1, 1)
 FROM ST_TestRaster(0, 0, 10) rast;
 
+-- Test being cheeky with rast2 in a single-rast invocation
+SELECT ST_Value(rast, 1, 1),
+    ST_Value(ST_MapAlgebra(rast, 1, NULL, '[rast2.val]+1'), 1, 1)
+FROM ST_TestRaster(0, 0, 10) rast;
+
 -- Test evaluations to null (see #1523)
 WITH op AS ( select rast AS rin,
   ST_MapAlgebra(rast, 1, NULL, 'SELECT g from (SELECT NULL::double precision as g) as foo', 2)
diff --git a/raster/test/regress/rt_mapalgebra_expr_expected b/raster/test/regress/rt_mapalgebra_expr_expected
index ac33621e0..dccd7fc46 100644
--- a/raster/test/regress/rt_mapalgebra_expr_expected
+++ b/raster/test/regress/rt_mapalgebra_expr_expected
@@ -18,6 +18,7 @@ T10.8.2|10|50
 T10.8.3|10|37
 T10.8.4|10|30
 ERROR:  division by zero
+ERROR:  rtpg_nmapalgebraexpr_callback: rast2 argument specified in single-raster invocation
 T11.1|10|2
 T11.2|10|2
 T12|t|t|t|t

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

Summary of changes:
 NEWS                                            | 3 ++-
 doc/introduction.xml                            | 1 +
 raster/rt_pg/rtpg_mapalgebra.c                  | 5 +++++
 raster/test/regress/rt_mapalgebra_expr.sql      | 5 +++++
 raster/test/regress/rt_mapalgebra_expr_expected | 1 +
 5 files changed, 14 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list