[SCM] PostGIS branch stable-3.4 updated. 3.4.3-5-g5e0838cbe

git at osgeo.org git at osgeo.org
Sun Sep 29 11:44:51 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.4 has been updated
       via  5e0838cbece9d293511505794631d222da2d0520 (commit)
      from  cd2bbba908a9d8a48de33100b5de83c5c8578cb8 (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 5e0838cbece9d293511505794631d222da2d0520
Author: Regina Obe <lr at pcorp.us>
Date:   Sun Sep 29 14:44:22 2024 -0400

    FIX for segfault in ST_MapAlgebra
    Closes #5785 for PostGIS 3.4.4
    Author: Dian M Fay

diff --git a/NEWS b/NEWS
index 1eb0eb37b..e5936ca45 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ PostGIS 3.4.4dev
 * Bug Fixes *
 
   - Quote-protect output paths of pgtopo_export (Sandro Santilli)
+  - #5785, [raster] ST_MapAlgebra segfaults when expression references
+         a supernumerary rast argument (Dian M Fay)
 
 
 
diff --git a/doc/introduction.xml b/doc/introduction.xml
index afbc8a805..cc99263f5 100644
--- a/doc/introduction.xml
+++ b/doc/introduction.xml
@@ -251,6 +251,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>Esteban Zimanyi</member>
diff --git a/raster/rt_pg/rtpg_mapalgebra.c b/raster/rt_pg/rtpg_mapalgebra.c
index b7010be6c..a9b7152d7 100644
--- a/raster/rt_pg/rtpg_mapalgebra.c
+++ b/raster/rt_pg/rtpg_mapalgebra.c
@@ -1179,6 +1179,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                                            | 2 ++
 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(+)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list