Skip to content

Commit

Permalink
GEOSConcaveHullOfPolygons: Avoid crash on zero-area input, references G…
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaston authored and pramsey committed Oct 24, 2024
1 parent b0e8114 commit 237bcac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/algorithm/hull/ConcaveHullOfPolygons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/capi/GEOSConcaveHullOfPolygonsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 237bcac

Please sign in to comment.