[geos-commits] [SCM] GEOS branch 3.12 updated. 237bcacd5b5049632092c800bb1a17958a97033a

git at osgeo.org git at osgeo.org
Thu Oct 24 13:11:00 PDT 2024


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.12 has been updated
       via  237bcacd5b5049632092c800bb1a17958a97033a (commit)
      from  b0e811480724deadc754b7fef247bcab15b6d01d (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 237bcacd5b5049632092c800bb1a17958a97033a
Author: Daniel Baston <dbaston at gmail.com>
Date:   Wed Jun 19 21:07:40 2024 -0400

    GEOSConcaveHullOfPolygons: Avoid crash on zero-area input, references GH-1071

diff --git a/NEWS.md b/NEWS.md
index 6af7744e3..017a4e2c0 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -8,6 +8,7 @@
   - GEOSLineSubstring: Fix crash on NaN length fractions (GH-1088, Dan Baston)
   - GEOSRelatePatternMatch: Fix crash on invalid DE-9IM pattern (GH-1089, Dan Baston)
   - Fix ConcaveHullOfPolygons nested shell handling (GH-1169, Martin Davis)
+  - GEOSConcaveHullOfPolygons, Avoid crash on zero-area input (GH-1071, Dan Baston)
 
 ## Changes in 3.12.2
 2024-06-05
diff --git a/src/algorithm/hull/ConcaveHullOfPolygons.cpp b/src/algorithm/hull/ConcaveHullOfPolygons.cpp
index 623a7662a..d49b5eff1 100644
--- a/src/algorithm/hull/ConcaveHullOfPolygons.cpp
+++ b/src/algorithm/hull/ConcaveHullOfPolygons.cpp
@@ -154,7 +154,7 @@ ConcaveHullOfPolygons::setTight(bool p_isTight)
 std::unique_ptr<Geometry>
 ConcaveHullOfPolygons::getHull()
 {
-    if (inputPolygons->isEmpty()) {
+    if (inputPolygons->isEmpty() || inputPolygons->getArea() == 0) {
         return createEmptyHull();
     }
     buildHullTris();
diff --git a/tests/unit/capi/GEOSConcaveHullOfPolygonsTest.cpp b/tests/unit/capi/GEOSConcaveHullOfPolygonsTest.cpp
index a5a485e9d..16a80299a 100644
--- a/tests/unit/capi/GEOSConcaveHullOfPolygonsTest.cpp
+++ b/tests/unit/capi/GEOSConcaveHullOfPolygonsTest.cpp
@@ -54,6 +54,15 @@ void object::test<2>()
     ensure_geometry_equals(geom1_, expected_);
 }
 
+template<>
+template<>
+void object::test<4>()
+{
+    input_ = fromWKT("POLYGON((0 0, 0 0, 0 0))");
+    result_ = GEOSConcaveHullOfPolygons(input_, 0.7, false, false);
+    ensure(GEOSisEmpty(result_));
+}
+
 
 } // namespace tut
 

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

Summary of changes:
 NEWS.md                                           | 1 +
 src/algorithm/hull/ConcaveHullOfPolygons.cpp      | 2 +-
 tests/unit/capi/GEOSConcaveHullOfPolygonsTest.cpp | 9 +++++++++
 3 files changed, 11 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list