[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0rc2-292-gb160678fe
git at osgeo.org
git at osgeo.org
Thu Oct 27 17:06:35 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, master has been updated
via b160678fec05658f61cb4627cf3909fdb69be42c (commit)
from 06f49e8dc83cfd7319709518ba479a3fd95e5000 (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 b160678fec05658f61cb4627cf3909fdb69be42c
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.4.0
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:
liblwgeom/lwgeom.c | 1 +
regress/core/snaptogrid.sql | 4 ++++
regress/core/snaptogrid_expected | 2 ++
3 files changed, 7 insertions(+)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list