[postgis-tickets] [SCM] PostGIS branch stable-2.5 updated. 2.5.8-2-g142b759e4

git at osgeo.org git at osgeo.org
Sat Oct 29 07:18:54 PDT 2022


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  142b759e4b1a22681cbb77db70831015f13898bc (commit)
      from  109164a45a4eb1fa38e28fa01b7b180111b3b7fe (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 142b759e4b1a22681cbb77db70831015f13898bc
Author: Regina Obe <lr at pcorp.us>
Date:   Thu Oct 27 19:18:56 2022 -0400

    Fix crash in ST_SnapToGrid on Empties
    References #5241 for PostGIS 2.5.9

diff --git a/NEWS b/NEWS
index 6790751d9..5564cdf18 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+PostGIS 2.5.9
+xxxx/xx/xx
+ * Bug fixes *
+
+  - #5241, Crash on ST_SnapToGrid with empty multis (Regina Obe)
+
 PostGIS 2.5.8
 2022/08/17
 
diff --git a/liblwgeom/lwgeom.c b/liblwgeom/lwgeom.c
index 896af661f..dc0b880c0 100644
--- a/liblwgeom/lwgeom.c
+++ b/liblwgeom/lwgeom.c
@@ -2152,6 +2152,7 @@ void
 lwgeom_grid_in_place(LWGEOM *geom, const gridspec *grid)
 {
 	if (!geom) return;
+	if (lwgeom_is_empty(geom)) return;
 	switch ( geom->type )
 	{
 		case POINTTYPE:
diff --git a/regress/snaptogrid.sql b/regress/snaptogrid.sql
index 0b6f5bd97..ae12da4d9 100644
--- a/regress/snaptogrid.sql
+++ b/regress/snaptogrid.sql
@@ -19,3 +19,7 @@ WITH geom AS
     SELECT ST_SnapToGrid('POLYGON((0 0, 10 0, 10 10, 10.6 10, 10.5 10.5, 10 10, 0 10, 0 0))', 'POINT(0 0)', 10, 10, 10, 10) as g
 )
 Select ST_AsText(g) as geometry, postgis_getbbox(g) AS box from geom;
+
+-- #5241
+SELECT '#5241' AS t, ST_AsText(ST_SnapToGrid( ST_GeomFromText('MULTIPOLYGON (((9 9, 9 1, 1 1, 2 4, 7 7, 9 9)), EMPTY)', 4326),  20.1, 20.1, 20.1, 20.1));
+SELECT '#5241' AS t, ST_AsText(ST_SnapToGrid( ST_GeomFromText('MULTIPOLYGON (((9 9, 9 1, 1 1, 2 4, 7 7, 9 9)), EMPTY)', 4326), 0.2, 0.2, 0.2, 0.2));
diff --git a/regress/snaptogrid_expected b/regress/snaptogrid_expected
index 518c1734b..2e8f2b4ab 100644
--- a/regress/snaptogrid_expected
+++ b/regress/snaptogrid_expected
@@ -5,3 +5,5 @@ t
 t
 POLYGON((0 0,10 0,10 10,0 10,0 0))|BOX(0 0,10 10)
 POLYGON((0 0,10 0,10 10,0 10,0 0))|BOX(0 0,10 10)
+#5241|MULTIPOLYGON EMPTY
+#5241|MULTIPOLYGON(((9 9,9 1,1 1,2 4,7.000000000000001 7.000000000000001,9 9)))

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

Summary of changes:
 NEWS                        | 6 ++++++
 liblwgeom/lwgeom.c          | 1 +
 regress/snaptogrid.sql      | 4 ++++
 regress/snaptogrid_expected | 2 ++
 4 files changed, 13 insertions(+)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list