[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0alpha2-95-g23c15ff

git at osgeo.org git at osgeo.org
Fri Oct 23 05:46:56 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  23c15ffa5e7e9a9e7783e859c5912cde51bcc592 (commit)
      from  a7851bb0659a86ed63f183fd8f536aa83942add7 (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 23c15ffa5e7e9a9e7783e859c5912cde51bcc592
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
    Closes https://github.com/postgis/postgis/pull/585/

diff --git a/NEWS b/NEWS
index 9de0012..ec3545c 100644
--- a/NEWS
+++ b/NEWS
@@ -47,7 +47,7 @@ Only tickets not included in 3.1.0alpha2
            as we do on geography_distance (Raúl Marín, Paul Ramsey, Regina Obe)
   - #4739, Ensure all functions using postgis_oid initialize the internal cache (Raúl Marín)
   - #4767, #4768, #4771, #4772, Fix segfault when parsing invalid WKB (Raúl Marín)
-
+  - #4769, Fix segfault in st_addband (Raúl Marín)
 
 
 PostGIS 3.1.0alpha2
diff --git a/raster/rt_pg/rtpg_create.c b/raster/rt_pg/rtpg_create.c
index 992fc51..f69865a 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 5520634..711a7ad 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 d3b27ae..ae1f56b 100644
--- a/raster/test/regress/tickets_expected
+++ b/raster/test/regress/tickets_expected
@@ -69,3 +69,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                                 |  2 +-
 raster/rt_pg/rtpg_create.c           | 11 +++++++++++
 raster/test/regress/tickets.sql      |  3 +++
 raster/test/regress/tickets_expected |  1 +
 4 files changed, 16 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list