[postgis-tickets] [SCM] PostGIS branch stable-3.0 updated. 3.0.1-29-g41d75a1

git at osgeo.org git at osgeo.org
Wed Jul 15 07:37:16 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-3.0 has been updated
       via  41d75a1941d1a3c1aa48a7ae035274616d830861 (commit)
      from  7fe4e853f6517b67f5fcbf81cc2e69c3b90dad64 (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 41d75a1941d1a3c1aa48a7ae035274616d830861
Author: Sandro Santilli <strk at kbt.io>
Date:   Wed Jul 15 16:33:42 2020 +0200

    Fix crash on TopoGeo_addPoint null arguments
    
    References #4722 in master 3.0 branch (3.0.2dev)

diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index 2a7e851..6430050 100644
--- a/topology/postgis_topology.c
+++ b/topology/postgis_topology.c
@@ -4670,6 +4670,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 = text_to_cstring(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 f7e791d..5daedaa 100644
--- a/topology/test/regress/topogeo_addpoint_expected
+++ b/topology/test/regress/topogeo_addpoint_expected
@@ -5,6 +5,9 @@ t
 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