[postgis-tickets] [SCM] PostGIS branch stable-3.3 updated. 3.3.1-19-gfe13a241e

git at osgeo.org git at osgeo.org
Fri Oct 28 15:38:45 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-3.3 has been updated
       via  fe13a241e4bd40100de361a13a41432bc57d6322 (commit)
      from  f9096602ccde96d41e236390dc601b55ffb632c9 (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 fe13a241e4bd40100de361a13a41432bc57d6322
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 3.3.2

diff --git a/NEWS b/NEWS
index e9f945662..4a176df3a 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ xxxx/xx/xx
   - #5255, GH598, Remove forced static linking on shp2pgsql, pgsql2shp (Maxim Kochetkov)
   - #5255, GH702, Remove forced static linking on raster2pgsql (Thomas Petazzoni)
   - #4648, Check function ownership at extension packaging time (Sandro Santilli)
+  - #5241, Crash on ST_SnapToGrid with empty multis (Regina Obe)
 
 
 PostGIS 3.3.1
diff --git a/liblwgeom/lwgeom.c b/liblwgeom/lwgeom.c
index e5f6fdb57..c7a1d1cd5 100644
--- a/liblwgeom/lwgeom.c
+++ b/liblwgeom/lwgeom.c
@@ -2166,6 +2166,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/core/snaptogrid.sql b/regress/core/snaptogrid.sql
index 0b6f5bd97..ae12da4d9 100644
--- a/regress/core/snaptogrid.sql
+++ b/regress/core/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/core/snaptogrid_expected b/regress/core/snaptogrid_expected
index 518c1734b..2e8f2b4ab 100644
--- a/regress/core/snaptogrid_expected
+++ b/regress/core/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                             | 1 +
 liblwgeom/lwgeom.c               | 1 +
 regress/core/snaptogrid.sql      | 4 ++++
 regress/core/snaptogrid_expected | 2 ++
 4 files changed, 8 insertions(+)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list