[postgis-tickets] [SCM] PostGIS branch stable-2.5 updated. 2.5.5-5-g279df53

git at osgeo.org git at osgeo.org
Fri Oct 23 05:55:58 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, stable-2.5 has been updated
       via  279df533083aaa5d8926bbdfb55a5fd43fefa1ea (commit)
      from  4c8a7077d62de5eeb068b9aa271c7deab2276297 (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 279df533083aaa5d8926bbdfb55a5fd43fefa1ea
Author: Raúl Marín <git at rmr.ninja>
Date:   Sun Oct 18 00:39:51 2020 +0200

    Fix segfault in st_addband
    
    References #4769

diff --git a/NEWS b/NEWS
index 140a60d..58758a1 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ YYYY/MM/DD
  * Bug fixes *
 
   - #4757, Handle line collapse due to snap-to-existing node (Sandro Santilli)
+  - #4769, Fix segfault in st_addband (Raúl Marín)
 
 PostGIS 2.5.5
 2020/08/15
diff --git a/raster/rt_pg/rtpg_create.c b/raster/rt_pg/rtpg_create.c
index 7dceed4..a1eeb6b 100644
--- a/raster/rt_pg/rtpg_create.c
+++ b/raster/rt_pg/rtpg_create.c
@@ -383,6 +383,17 @@ Datum RASTER_addBandRasterArray(PG_FUNCTION_ARGS)
 		POSTGIS_RT_DEBUG(4, "destination raster isn't NULL");
 	}
 
+	if (PG_ARGISNULL(1))
+	{
+		if (raster != NULL)
+		{
+			rt_raster_destroy(raster);
+			PG_RETURN_POINTER(pgraster);
+		}
+		else
+			PG_RETURN_NULL();
+	}
+
 	/* source rasters' band index, 1-based */
 	if (!PG_ARGISNULL(2))
 		srcnband = PG_GETARG_INT32(2);
diff --git a/raster/test/regress/tickets.sql b/raster/test/regress/tickets.sql
index 68c970b..b63d3a6 100644
--- a/raster/test/regress/tickets.sql
+++ b/raster/test/regress/tickets.sql
@@ -142,3 +142,6 @@ INSERT INTO ticket_4547 VALUES (null);
 INSERT INTO ticket_4547 SELECT ST_AddBand(ST_MakeEmptyRaster(10, 10, 1, 1, 2, 2, 0, 0,4326), 1, '8BSI'::text, -129, NULL);
 SELECT '#4547.2', AddRasterConstraints('ticket_4547', 'r');
 DROP TABLE ticket_4547;
+
+-- #4769
+SELECT '#4769', st_addband(NULL, NULL::_raster, 1, 1);
\ No newline at end of file
diff --git a/raster/test/regress/tickets_expected b/raster/test/regress/tickets_expected
index d248573..2152be6 100644
--- a/raster/test/regress/tickets_expected
+++ b/raster/test/regress/tickets_expected
@@ -68,3 +68,4 @@ NOTICE:  Adding nodata value constraint
 NOTICE:  Adding out-of-database constraint
 NOTICE:  Adding maximum extent constraint
 #4547.2|t
+#4769|

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

Summary of changes:
 NEWS                                 |  1 +
 raster/rt_pg/rtpg_create.c           | 11 +++++++++++
 raster/test/regress/tickets.sql      |  3 +++
 raster/test/regress/tickets_expected |  1 +
 4 files changed, 16 insertions(+)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list