Skip to content

Commit

Permalink
GEOSConcaveHullOfPolygons: Avoid crash on zero-area input
Browse files Browse the repository at this point in the history
Resolves libgeos#1071
  • Loading branch information
dbaston committed Apr 20, 2024
1 parent 60e0ae2 commit 71ec44b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/algorithm/hull/ConcaveHullOfPolygons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ ConcaveHullOfPolygons::setTight(bool p_isTight)
std::unique_ptr<Geometry>
ConcaveHullOfPolygons::getHull()
{
if (inputPolygons->isEmpty()) {
if (inputPolygons->isEmpty() || inputPolygons->getEnvelopeInternal()->getArea() == 0) {
return createEmptyHull();
}
buildHullTris();
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/capi/GEOSConcaveHullOfPolygonsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ void object::test<2>()
ensure_geometry_equals(geom1_, expected_);
}

template<>
template<>
void object::test<3>()
{
input_ = fromWKT("POLYGON((0 0, 0 0, 0 0))");
result_ = GEOSConcaveHullOfPolygons(input_, 0.7, false, false);
}


} // namespace tut

0 comments on commit 71ec44b

Please sign in to comment.