[postgis-tickets] [SCM] PostGIS branch stable-3.1 updated. 3.1.0-2-g6d74ddc
git at osgeo.org
git at osgeo.org
Mon Dec 21 03:41:54 PST 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-3.1 has been updated
via 6d74ddcf9dd40c8dee9dfacbb4da31a7e9eead89 (commit)
from c9c8468d7d8fbfb542c02a1d97cf6b30f72d9424 (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 6d74ddcf9dd40c8dee9dfacbb4da31a7e9eead89
Author: Sandro Santilli <strk at kbt.io>
Date: Mon Dec 21 12:34:46 2020 +0100
Do not free 0-allocated geoms vector for made-valid empty collections
References #4814 in 3.1 branch
Includes unit test and NEWS entry
diff --git a/NEWS b/NEWS
index 63a7f04..cf775d2 100644
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,7 @@ PostGIS 3.1.1
* Bug Fixes
- - #xxxx,
+ - #4814, Crash passing collection with only empty components to ST_MakeValid
PostGIS 3.1.0
diff --git a/liblwgeom/cunit/cu_clean.c b/liblwgeom/cunit/cu_clean.c
index e3652c5..291bc6b 100644
--- a/liblwgeom/cunit/cu_clean.c
+++ b/liblwgeom/cunit/cu_clean.c
@@ -147,6 +147,24 @@ static void test_lwgeom_make_valid(void)
lwgeom_free(gout);
lwgeom_free(gin);
+
+ /* Test collection with empty component */
+
+ gin = lwgeom_from_hexwkb( "0106000020110F000000000000",
+ LW_PARSER_CHECK_NONE);
+ CU_ASSERT(gin != NULL);
+
+ gout = lwgeom_make_valid(gin);
+ CU_ASSERT(gout != NULL);
+
+ ewkt = lwgeom_to_ewkt(gout);
+ /* printf("c = %s\n", ewkt); */
+ CU_ASSERT_STRING_EQUAL(ewkt, "MULTIPOLYGON EMPTY");
+ lwfree(ewkt);
+
+ lwgeom_free(gout);
+ lwgeom_free(gin);
+
}
/* TODO: add more tests ! */
diff --git a/liblwgeom/lwgeom_geos_clean.c b/liblwgeom/lwgeom_geos_clean.c
index 3714e63..878d91b 100644
--- a/liblwgeom/lwgeom_geos_clean.c
+++ b/liblwgeom/lwgeom_geos_clean.c
@@ -322,6 +322,8 @@ lwcollection_make_geos_friendly(LWCOLLECTION* g)
uint32_t i, new_ngeoms = 0;
LWCOLLECTION* ret;
+ if ( ! g->ngeoms ) return lwcollection_as_lwgeom(g);
+
/* enough space for all components */
new_geoms = lwalloc(sizeof(LWGEOM*) * g->ngeoms);
-----------------------------------------------------------------------
Summary of changes:
NEWS | 2 +-
liblwgeom/cunit/cu_clean.c | 18 ++++++++++++++++++
liblwgeom/lwgeom_geos_clean.c | 2 ++
3 files changed, 21 insertions(+), 1 deletion(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list