[geos-commits] [SCM] GEOS branch 3.9 updated. 13abebc94abe7b269104e85ba57181bbc17911b8
git at osgeo.org
git at osgeo.org
Mon Mar 8 16:56:31 PST 2021
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 "GEOS".
The branch, 3.9 has been updated
via 13abebc94abe7b269104e85ba57181bbc17911b8 (commit)
via 57ca44f2edf16c08b86111d38b252c43b0851718 (commit)
from f0432996b098e4c8e7c1661ae9f12c62ac3fc367 (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 13abebc94abe7b269104e85ba57181bbc17911b8
Author: Daniel Baston <dbaston at gmail.com>
Date: Mon Mar 8 19:55:38 2021 -0500
Add NEWS entry
diff --git a/NEWS b/NEWS
index 106ffe3..afc8202 100644
--- a/NEWS
+++ b/NEWS
@@ -2,7 +2,9 @@ Changes in 3.9.2
2021-xx-xx
- Bug fixes / improvements:
- - Add in interrupt points in OverlayNG (#4857, Paul Ramsey)
+ - Add in interrupt points in OverlayNG (#4857, Paul Ramsey)
+ - Fix crash in GEOSPreparedIntersects and GEOSPreparedContains for
+ POINT EMPTY input (Even Rouault)
Changes in 3.9.1
commit 57ca44f2edf16c08b86111d38b252c43b0851718
Author: Even Rouault <even.rouault at spatialys.com>
Date: Mon Mar 8 16:51:00 2021 +0100
Fix crash with GEOSPreparedIntersects/Covers on a POINT EMPTY
Fixes use case spotted by https://github.com/OSGeo/gdal/issues/3542#issuecomment-792659437
diff --git a/src/geom/prep/BasicPreparedGeometry.cpp b/src/geom/prep/BasicPreparedGeometry.cpp
index d637401..59f5d6e 100644
--- a/src/geom/prep/BasicPreparedGeometry.cpp
+++ b/src/geom/prep/BasicPreparedGeometry.cpp
@@ -42,7 +42,11 @@ bool
BasicPreparedGeometry::envelopesIntersect(const geom::Geometry* g) const
{
if (g->getGeometryTypeId() == GEOS_POINT) {
- return baseGeom->getEnvelopeInternal()->intersects(*(g->getCoordinate()));
+ auto pt = g->getCoordinate();
+ if (pt == nullptr) {
+ return false;
+ }
+ return baseGeom->getEnvelopeInternal()->intersects(*pt);
}
return baseGeom->getEnvelopeInternal()->intersects(g->getEnvelopeInternal());
@@ -52,7 +56,11 @@ bool
BasicPreparedGeometry::envelopeCovers(const geom::Geometry* g) const
{
if (g->getGeometryTypeId() == GEOS_POINT) {
- return baseGeom->getEnvelopeInternal()->covers(g->getCoordinate());
+ auto pt = g->getCoordinate();
+ if (pt == nullptr) {
+ return false;
+ }
+ return baseGeom->getEnvelopeInternal()->covers(pt);
}
return baseGeom->getEnvelopeInternal()->covers(g->getEnvelopeInternal());
diff --git a/tests/unit/capi/GEOSPreparedGeometryTest.cpp b/tests/unit/capi/GEOSPreparedGeometryTest.cpp
index 040d0d1..a79d532 100644
--- a/tests/unit/capi/GEOSPreparedGeometryTest.cpp
+++ b/tests/unit/capi/GEOSPreparedGeometryTest.cpp
@@ -393,5 +393,40 @@ void object::test<11>
ensure_equals(ret, 0);
}
}
+
+// Test PreparedIntersects with Point EMPTY
+template<>
+template<>
+void object::test<12>
+()
+{
+ geom1_ = GEOSGeomFromWKT("POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))");
+ geom2_ = GEOSGeomFromWKT("POINT EMPTY");
+ prepGeom1_ = GEOSPrepare(geom1_);
+
+ ensure(nullptr != prepGeom1_);
+ ensure(nullptr != geom2_);
+
+ int ret = GEOSPreparedIntersects(prepGeom1_, geom2_);
+ ensure_equals(ret, 0);
+}
+
+// Test PreparedCovers with Point EMPTY
+template<>
+template<>
+void object::test<13>
+()
+{
+ geom1_ = GEOSGeomFromWKT("POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))");
+ geom2_ = GEOSGeomFromWKT("POINT EMPTY");
+ prepGeom1_ = GEOSPrepare(geom1_);
+
+ ensure(nullptr != prepGeom1_);
+ ensure(nullptr != geom2_);
+
+ int ret = GEOSPreparedCovers(prepGeom1_, geom2_);
+ ensure_equals(ret, 0);
+}
+
} // namespace tut
-----------------------------------------------------------------------
Summary of changes:
NEWS | 4 +++-
src/geom/prep/BasicPreparedGeometry.cpp | 12 ++++++++--
tests/unit/capi/GEOSPreparedGeometryTest.cpp | 35 ++++++++++++++++++++++++++++
3 files changed, 48 insertions(+), 3 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list