Skip to content

Commit fc0722f

Browse files
authored
GEOSConcaveHullOfPolygons: Avoid crash on zero-area input (#1076)
* GEOSConcaveHullOfPolygons: Avoid crash on zero-area input Resolves #1071
1 parent 87e98b7 commit fc0722f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/algorithm/hull/ConcaveHullOfPolygons.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ ConcaveHullOfPolygons::setTight(bool p_isTight)
156156
std::unique_ptr<Geometry>
157157
ConcaveHullOfPolygons::getHull()
158158
{
159-
if (inputPolygons->isEmpty()) {
159+
if (inputPolygons->isEmpty() || inputPolygons->getArea() == 0) {
160160
return createEmptyHull();
161161
}
162162
buildHullTris();

tests/unit/capi/GEOSConcaveHullOfPolygonsTest.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ void object::test<3>()
6262
result_ = GEOSConcaveHullOfPolygons(input_, 0.7, false, false);
6363
ensure("curved geometry not supported", result_ == nullptr);
6464
}
65+
66+
template<>
67+
template<>
68+
void object::test<4>()
69+
{
70+
input_ = fromWKT("POLYGON((0 0, 0 0, 0 0))");
71+
result_ = GEOSConcaveHullOfPolygons(input_, 0.7, false, false);
72+
ensure(GEOSisEmpty(result_));
73+
}
6574

6675

6776
} // namespace tut

0 commit comments

Comments
 (0)