Skip to content

Commit

Permalink
GEOSConcaveHullOfPolygons: Avoid crash on zero-area input (#1076)
Browse files Browse the repository at this point in the history
* GEOSConcaveHullOfPolygons: Avoid crash on zero-area input

Resolves #1071
  • Loading branch information
dbaston authored Jun 20, 2024
1 parent 87e98b7 commit fc0722f
Show file tree
Hide file tree
Showing 2 changed files with 10 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 @@ -156,7 +156,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 @@ -62,6 +62,15 @@ void object::test<3>()
result_ = GEOSConcaveHullOfPolygons(input_, 0.7, false, false);
ensure("curved geometry not supported", result_ == nullptr);
}

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
Expand Down

0 comments on commit fc0722f

Please sign in to comment.