[postgis-tickets] [SCM] PostGIS branch stable-2.4 updated. c62c93fa5766e4509ec29b523fdca6458e99cf3a

git at osgeo.org git at osgeo.org
Wed Jul 15 07:39:27 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  c62c93fa5766e4509ec29b523fdca6458e99cf3a (commit)
      from  dabcb3194e4383013fffd5cb09cd7d6596b9b710 (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 c62c93fa5766e4509ec29b523fdca6458e99cf3a
Author: Sandro Santilli <strk at kbt.io>
Date:   Wed Jul 15 16:33:42 2020 +0200

    Fix crash on TopoGeo_addPoint null arguments
    
    Closes #4722 in 2.4 branch (2.4.9dev)

diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index 3e1a2f0..a4ce47d 100644
--- a/topology/postgis_topology.c
+++ b/topology/postgis_topology.c
@@ -4317,6 +4317,12 @@ Datum TopoGeo_AddPoint(PG_FUNCTION_ARGS)
   LWPOINT *pt;
   LWT_TOPOLOGY *topo;
 
+  if ( PG_ARGISNULL(0) || PG_ARGISNULL(1) || PG_ARGISNULL(2) )
+  {
+    lwpgerror("SQL/MM Spatial exception - null argument");
+    PG_RETURN_NULL();
+  }
+
   toponame_text = PG_GETARG_TEXT_P(0);
   toponame = text2cstring(toponame_text);
 	PG_FREE_IF_COPY(toponame_text, 0);
diff --git a/topology/test/regress/topogeo_addpoint.sql b/topology/test/regress/topogeo_addpoint.sql
index c023327..b7c4f92 100644
--- a/topology/test/regress/topogeo_addpoint.sql
+++ b/topology/test/regress/topogeo_addpoint.sql
@@ -7,6 +7,10 @@ set client_min_messages to ERROR;
 SELECT 'invalid', TopoGeo_addPoint('city_data', 'LINESTRING(36 26, 38 30)');
 SELECT 'invalid', TopoGeo_addPoint('city_data', 'MULTIPOINT((36 26))');
 SELECT 'invalid', TopoGeo_addPoint('invalid', 'POINT(36 26)');
+-- See #4722
+SELECT 'invalid', TopoGeo_addPoint(null::varchar, null::geometry, null::float8);
+SELECT 'invalid', TopoGeo_addPoint(null::varchar, 'POINT(36 36)'::geometry, null::float8);
+SELECT 'invalid', TopoGeo_addPoint('city_data', null::geometry, null::float8);
 
 -- Save max node id
 select 'node'::text as what, max(node_id) INTO city_data.limits FROM city_data.node;
diff --git a/topology/test/regress/topogeo_addpoint_expected b/topology/test/regress/topogeo_addpoint_expected
index ce32d19..e2e65d5 100644
--- a/topology/test/regress/topogeo_addpoint_expected
+++ b/topology/test/regress/topogeo_addpoint_expected
@@ -7,6 +7,9 @@ COMMIT
 ERROR:  Invalid geometry type (LINESTRING) passed to TopoGeo_AddPoint, expected POINT
 ERROR:  Invalid geometry type (MULTIPOINT) passed to TopoGeo_AddPoint, expected POINT
 ERROR:  No topology with name "invalid" in topology.topology
+ERROR:  SQL/MM Spatial exception - null argument
+ERROR:  SQL/MM Spatial exception - null argument
+ERROR:  SQL/MM Spatial exception - null argument
 iso_uni|23
 iso_f3|24
 iso_ex|23

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

Summary of changes:
 topology/postgis_topology.c                     | 6 ++++++
 topology/test/regress/topogeo_addpoint.sql      | 4 ++++
 topology/test/regress/topogeo_addpoint_expected | 3 +++
 3 files changed, 13 insertions(+)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list