[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0rc2-625-g633cf975c

git at osgeo.org git at osgeo.org
Thu Feb 16 10:21:14 PST 2023


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  633cf975c931a2b74455dc3673840c7b30af0e14 (commit)
      from  cc2455bde3257754b5d052357c241d4eab400286 (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 633cf975c931a2b74455dc3673840c7b30af0e14
Author: Regina Obe <lr at pcorp.us>
Date:   Thu Feb 16 02:41:52 2023 -0500

    Prevent crash on infinite coordinates
    for PostGIS 3.4
    References #5319 ST_SetPoint
    References #5315 ST_Buffer
    References #5318 ST_MaximumnInscribedCircle

diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c
index 1bf6f0bc4..72e61bf77 100644
--- a/postgis/lwgeom_functions_basic.c
+++ b/postgis/lwgeom_functions_basic.c
@@ -2444,6 +2444,7 @@ Datum LWGEOM_setpoint_linestring(PG_FUNCTION_ARGS)
 
 	lwg = lwgeom_from_gserialized(pglwg1);
 	line = lwgeom_as_lwline(lwg);
+
 	if (!line)
 	{
 		elog(ERROR, "First argument must be a LINESTRING");
@@ -2455,6 +2456,12 @@ Datum LWGEOM_setpoint_linestring(PG_FUNCTION_ARGS)
 		PG_RETURN_NULL();
 	}
 
+	if (!lwgeom_isfinite(lwg))
+	{
+		elog(ERROR, "Geometry contains invalid coordinate");
+		PG_RETURN_NULL();
+	}
+
 	if (which < 0)
 	{
 		/* Use backward indexing for negative values */
diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c
index 3349c2612..10b088d03 100644
--- a/postgis/lwgeom_geos.c
+++ b/postgis/lwgeom_geos.c
@@ -397,6 +397,13 @@ Datum ST_MaximumInscribedCircle(PG_FUNCTION_ARGS)
 		double width, height, size, tolerance;
 		GBOX gbox;
 		int gtype;
+		LWGEOM *lwg;
+		lwg = lwgeom_from_gserialized(geom);
+		if (!lwgeom_isfinite(lwg))
+		{
+			lwpgerror("Geometry contains invalid coordinates");
+			PG_RETURN_NULL();
+		}
 
 		if (!gserialized_get_gbox_p(geom, &gbox))
 			PG_RETURN_NULL();
@@ -978,6 +985,14 @@ Datum buffer(PG_FUNCTION_ARGS)
 		PG_RETURN_POINTER(geometry_serialize(lwg));
 	}
 
+	lwg = lwgeom_from_gserialized(geom1);
+
+	if (!lwgeom_isfinite(lwg))
+	{
+		lwpgerror("Geometry contains invalid coordinates");
+		PG_RETURN_NULL();
+	}
+
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
 	g1 = POSTGIS2GEOS(geom1);
diff --git a/regress/core/geos39.sql b/regress/core/geos39.sql
index 8885fdd85..4a444a418 100644
--- a/regress/core/geos39.sql
+++ b/regress/core/geos39.sql
@@ -42,3 +42,6 @@ SELECT 'mic-cte' AS name, ST_AsText(st_snaptogrid((ST_MaximumInscribedCircle(ply
 SELECT 'rp-1', ST_AsText(ST_ReducePrecision('POINT(1.412 19.323)', 0.1));
 SELECT 'rp-2', ST_AsText(ST_ReducePrecision('POINT(1.412 19.323)', 1.0));
 SELECT 'rp-3', ST_AsText(ST_ReducePrecision('POINT(1.412 19.323)', 10));
+
+-- ST_MaximumInscribedCircle infinite check https://trac.osgeo.org/postgis/ticket/5318
+SELECT '#5318', ST_MaximumInscribedCircle('0106000020E61000000100000001030000000100000005000000000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F'::geometry) As result;
diff --git a/regress/core/geos39_expected b/regress/core/geos39_expected
index 06ebbd417..ec9be2b85 100644
--- a/regress/core/geos39_expected
+++ b/regress/core/geos39_expected
@@ -8,3 +8,4 @@ mic-cte|POINT(49.512 49.512)
 rp-1|POINT(1.4 19.3)
 rp-2|POINT(1 19)
 rp-3|POINT(0 20)
+ERROR:  Geometry contains invalid coordinates
diff --git a/regress/core/setpoint.sql b/regress/core/setpoint.sql
index 51519ac54..553e50309 100644
--- a/regress/core/setpoint.sql
+++ b/regress/core/setpoint.sql
@@ -26,3 +26,6 @@ SELECT ST_asewkt(ST_SetPoint('LINESTRING(0 0 0 0, 1 1 1 1, 2 2 2 2, 4 4 4 4)', 2
 SELECT ST_asewkt(ST_SetPoint('LINESTRING(0 0 0 0, 1 1 1 1, 2 2 2 2, 4 4 4 4)', 1, 'POINTM(90 91 92)'));
 SELECT ST_asewkt(ST_SetPoint('LINESTRING(0 0 0 0, 1 1 1 1, 2 2 2 2, 4 4 4 4)', 0, 'POINT(90 91 92 93)'));
 
+-- https://trac.osgeo.org/postgis/ticket/5319
+SELECT '#5319', ST_SetPoint('0102000020E610000005000000000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F'::geometry, 1,ST_GeomFromText('POINT(0 0)',4326)  )  As result;
+
diff --git a/regress/core/setpoint_expected b/regress/core/setpoint_expected
index 210195c40..cbc622b07 100644
--- a/regress/core/setpoint_expected
+++ b/regress/core/setpoint_expected
@@ -11,3 +11,4 @@ LINESTRING(0 0 0 0,1 1 1 1,2 2 2 2,90 91 0 0)
 LINESTRING(0 0 0 0,1 1 1 1,90 91 92 0,4 4 4 4)
 LINESTRING(0 0 0 0,90 91 0 92,2 2 2 2,4 4 4 4)
 LINESTRING(90 91 92 93,1 1 1 1,2 2 2 2,4 4 4 4)
+ERROR:  Geometry contains invalid coordinate
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index 7ce4de725..70c0f2132 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1479,3 +1479,5 @@ reset max_parallel_workers_per_gather;
 reset force_parallel_mode;
 
 SET client_min_messages TO NOTICE;
+-- https://trac.osgeo.org/postgis/ticket/5315
+SELECT '#5315', ST_Buffer('0106000020E86400000100000001030000000100000005000000000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F'::geometry, 1);
diff --git a/regress/core/tickets_expected b/regress/core/tickets_expected
index 706ef3c5b..258c4f10e 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -462,3 +462,4 @@ ERROR:  LWGEOM_addpoint: Invalid offset
 ERROR:  Line has no points
 #5139|100000
 #5139|1000000
+ERROR:  Geometry contains invalid coordinates

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

Summary of changes:
 postgis/lwgeom_functions_basic.c |  7 +++++++
 postgis/lwgeom_geos.c            | 15 +++++++++++++++
 regress/core/geos39.sql          |  3 +++
 regress/core/geos39_expected     |  1 +
 regress/core/setpoint.sql        |  3 +++
 regress/core/setpoint_expected   |  1 +
 regress/core/tickets.sql         |  2 ++
 regress/core/tickets_expected    |  1 +
 8 files changed, 33 insertions(+)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list