[postgis-tickets] [SCM] PostGIS branch stable-2.5 updated. 2.5.4-22-g9be75d1

git at osgeo.org git at osgeo.org
Wed Jul 15 07:38:36 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.5 has been updated
       via  9be75d18e77d786161fff3f0528c1aad3e7d67ce (commit)
      from  9e26d71d341b8236c485377113ae8647bced91a5 (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 9be75d18e77d786161fff3f0528c1aad3e7d67ce
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 2.5 branch (2.5.5dev)

diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index abb70e5..eba8232 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 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