[postgis-tickets] [SCM] PostGIS branch stable-2.4 updated. 2.4.9-3-ge4c7a1f

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

    Fix segfault in st_addband
    
    Closes #4769

diff --git a/NEWS b/NEWS
index 47e1f48..e6b96b3 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ YYYY/MM/DD
   * Bug Fixes and Enhancements *
 
   - #4757, Handle line collapse due to snap-to-existing node (Sandro Santilli)
+  - #4769, Fix segfault in st_addband (Raúl Marín)
 
 PostGIS 2.4.9
 2020/08/14
diff --git a/raster/rt_pg/rtpg_create.c b/raster/rt_pg/rtpg_create.c
index 992ffe3..3afabb5 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 0d94231..67778ca 100644
--- a/raster/test/regress/tickets.sql
+++ b/raster/test/regress/tickets.sql
@@ -135,3 +135,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 fee0e70..03d9cc0 100644
--- a/raster/test/regress/tickets_expected
+++ b/raster/test/regress/tickets_expected
@@ -65,3 +65,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