[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0alpha1-165-gf0b631a

git at osgeo.org git at osgeo.org
Wed Jul 15 07:36:50 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  f0b631a808d5e4bc0bf30055e2777e2649b8df0f (commit)
      from  3bd678013beefac822c760fd84a02acd9acb94b0 (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 f0b631a808d5e4bc0bf30055e2777e2649b8df0f
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 branch (3.1.0dev)

diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index 32bedb0..3acc5c6 100644
--- a/topology/postgis_topology.c
+++ b/topology/postgis_topology.c
@@ -4658,6 +4658,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