[geos-commits] [SCM] GEOS branch 3.12 updated. 16c92dbb20de08fa0be7ae8d10d69fcef63236ef
git at osgeo.org
git at osgeo.org
Mon Jun 17 11:09:40 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 16c92dbb20de08fa0be7ae8d10d69fcef63236ef (commit)
via 24d01ae23e9a3a6be73b3a783f4e589ca159afcf (commit)
via ae8fbb46c0cc5c6f9e727b9604b5705c2cdad960 (commit)
via c077f176d1ccb907998843134ea2e8757a7f19ac (commit)
via 44f17e15b677d3c6d073ba637aa7bff67f229dcb (commit)
from c5532795d12bb23057db6c3d5a5f2e1dae09526c (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 16c92dbb20de08fa0be7ae8d10d69fcef63236ef
Author: Daniel Baston <dbaston at gmail.com>
Date: Mon Jun 17 14:06:25 2024 -0400
NEWS updates
diff --git a/NEWS.md b/NEWS.md
index 4c1f30928..8d7d65e39 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -3,6 +3,10 @@
- Fixes:
- TopologyPreservingSimplifier: fix to remove ring endpoints safely (GH-1110, Martin Davis)
+ - Centroid: Fix crash on polygons with empty holes (GH-1075, Dan Baston)
+ - MinimumClearance: Fix crash on NaN inputs (GH-1082, Dan Baston)
+ - GEOSLineSubstring: Fix crash on NaN length fractions (GH-1088, Dan Baston)
+ - GEOSRelatePatternMatch: Fix crash on invalid DE-9IM pattern (GH-1089, Dan Baston)
## Changes in 3.12.2
2024-06-05
commit 24d01ae23e9a3a6be73b3a783f4e589ca159afcf
Author: Daniel Baston <dbaston at gmail.com>
Date: Tue Apr 30 18:37:19 2024 -0400
IntersectionMatrix: Ignore patterns longer than 9 characters
Fixes https://github.com/libgeos/geos/issues/1084
diff --git a/src/geom/IntersectionMatrix.cpp b/src/geom/IntersectionMatrix.cpp
index 82acfcf4e..f7ace8a9e 100644
--- a/src/geom/IntersectionMatrix.cpp
+++ b/src/geom/IntersectionMatrix.cpp
@@ -144,7 +144,7 @@ IntersectionMatrix::set(Location row, Location col, int dimensionValue)
void
IntersectionMatrix::set(const std::string& dimensionSymbols)
{
- auto limit = dimensionSymbols.length();
+ auto limit = std::min(dimensionSymbols.length(), static_cast<std::size_t>(9));
for(std::size_t i = 0; i < limit; i++) {
auto row = i / firstDim;
diff --git a/tests/unit/capi/GEOSRelatePatternMatchTest.cpp b/tests/unit/capi/GEOSRelatePatternMatchTest.cpp
index c5f34a40b..b60ab1e18 100644
--- a/tests/unit/capi/GEOSRelatePatternMatchTest.cpp
+++ b/tests/unit/capi/GEOSRelatePatternMatchTest.cpp
@@ -78,5 +78,18 @@ void object::test<5>
ensure_equals(ret, char(0));
}
+// invalid DE-9IM argument
+// https://github.com/libgeos/geos/issues/1084
+template<>
+template<>
+void object::test<6>
+()
+{
+ const char* mat = "0000000000";
+ ensure_equals(strlen(mat), 10u); // not a valid DE-9IM!
+
+ GEOSRelatePatternMatch(mat, "111111111");
+}
+
} // namespace tut
commit ae8fbb46c0cc5c6f9e727b9604b5705c2cdad960
Author: Daniel Baston <dbaston at gmail.com>
Date: Tue Apr 30 17:43:35 2024 -0400
GEOSLineSubstring: Avoid crash with NaN length fraction
Fixes https://github.com/libgeos/geos/issues/1077
diff --git a/src/linearref/LengthIndexedLine.cpp b/src/linearref/LengthIndexedLine.cpp
index 012a9dc43..5522eb32c 100644
--- a/src/linearref/LengthIndexedLine.cpp
+++ b/src/linearref/LengthIndexedLine.cpp
@@ -57,6 +57,13 @@ LengthIndexedLine::extractPoint(double index, double offsetDistance) const
std::unique_ptr<Geometry>
LengthIndexedLine::extractLine(double startIndex, double endIndex) const
{
+ if (std::isnan(startIndex)) {
+ throw util::IllegalArgumentException("startIndex is NaN");
+ }
+ if (std::isnan(endIndex)) {
+ throw util::IllegalArgumentException("endIndex is NaN");
+ }
+
const LocationIndexedLine lil(linearGeom);
const double startIndex2 = clampIndex(startIndex);
const double endIndex2 = clampIndex(endIndex);
diff --git a/tests/unit/capi/GEOSInterpolateTest.cpp b/tests/unit/capi/GEOSInterpolateTest.cpp
index 3b5a49f60..44992617f 100644
--- a/tests/unit/capi/GEOSInterpolateTest.cpp
+++ b/tests/unit/capi/GEOSInterpolateTest.cpp
@@ -72,4 +72,14 @@ void object::test<4>
ensure_geometry_equals(result_, expected_);
}
+// ensure NaN argument does not crash
+template<>
+template<>
+void object::test<5>
+()
+{
+ geom1_ = GEOSGeomFromWKT("LINESTRING (0 0, 1 1)");
+ result_ = GEOSInterpolate(geom1_, std::numeric_limits<double>::quiet_NaN());
+}
+
} // namespace tut
diff --git a/tests/unit/capi/GEOSLineSubstringTest.cpp b/tests/unit/capi/GEOSLineSubstringTest.cpp
index c75930792..0b9ffaf09 100644
--- a/tests/unit/capi/GEOSLineSubstringTest.cpp
+++ b/tests/unit/capi/GEOSLineSubstringTest.cpp
@@ -120,5 +120,20 @@ void object::test<6>
}
+// NaN start fraction
+// https://github.com/libgeos/geos/issues/1077
+template<>
+template<>
+void object::test<8>
+()
+{
+ input_ = fromWKT("LINESTRING EMPTY");
+ double start = std::numeric_limits<double>::quiet_NaN();
+ double end = 0.1;
+ result_ = GEOSLineSubstring(input_, start, end);
+
+ ensure(result_ == nullptr);
+}
+
} // namespace tut
commit c077f176d1ccb907998843134ea2e8757a7f19ac
Author: Daniel Baston <dbaston at gmail.com>
Date: Sat Apr 20 17:53:03 2024 -0400
MinimumClearance: Avoid crash on NaN inputs
Resolves https://github.com/libgeos/geos/issues/1079
diff --git a/src/precision/MinimumClearance.cpp b/src/precision/MinimumClearance.cpp
index cc6b293d0..0a5e9e823 100644
--- a/src/precision/MinimumClearance.cpp
+++ b/src/precision/MinimumClearance.cpp
@@ -176,6 +176,10 @@ MinimumClearance::compute()
MinClearanceDistance mcd;
auto nearest = tree->nearestNeighbour(mcd);
+ if (nearest.first == nullptr || nearest.second == nullptr) {
+ throw util::GEOSException("Failed to find nearest items");
+ }
+
minClearance = mcd.distance(nearest.first, nearest.second);
const std::vector<Coordinate>* minClearancePtsVec = mcd.getCoordinates();
diff --git a/tests/unit/capi/GEOSMinimumClearanceTest.cpp b/tests/unit/capi/GEOSMinimumClearanceTest.cpp
index f683145da..e0c777afd 100644
--- a/tests/unit/capi/GEOSMinimumClearanceTest.cpp
+++ b/tests/unit/capi/GEOSMinimumClearanceTest.cpp
@@ -120,4 +120,14 @@ void object::test<5>
geos::DoubleInfinity);
}
+template<>
+template<>
+void object::test<6>
+()
+{
+ input_ = GEOSGeom_createPointFromXY(std::numeric_limits<double>::quiet_NaN(), 1);
+ double d;
+ ensure_equals(GEOSMinimumClearance(input_, &d), 2);
+}
+
} // namespace tut
commit 44f17e15b677d3c6d073ba637aa7bff67f229dcb
Author: Daniel Baston <dbaston at gmail.com>
Date: Fri Apr 19 19:49:55 2024 -0400
Centroid: Avoid crash with empty hole
Resolves https://github.com/libgeos/geos/issues/1073
diff --git a/src/algorithm/Centroid.cpp b/src/algorithm/Centroid.cpp
index fa9355421..168a0996e 100644
--- a/src/algorithm/Centroid.cpp
+++ b/src/algorithm/Centroid.cpp
@@ -124,6 +124,10 @@ Centroid::addShell(const CoordinateSequence& pts)
void
Centroid::addHole(const CoordinateSequence& pts)
{
+ if (pts.isEmpty()) {
+ return;
+ }
+
bool isPositiveArea = Orientation::isCCW(&pts);
for(std::size_t i = 0, e = pts.size() - 1; i < e; ++i) {
addTriangle(*areaBasePt, pts.getAt<CoordinateXY>(i), pts.getAt<CoordinateXY>(i + 1), isPositiveArea);
diff --git a/tests/unit/algorithm/CentroidTest.cpp b/tests/unit/algorithm/CentroidTest.cpp
index 40ec77b55..152d12dff 100644
--- a/tests/unit/algorithm/CentroidTest.cpp
+++ b/tests/unit/algorithm/CentroidTest.cpp
@@ -122,5 +122,11 @@ void object::test<5>() {
"POLYGON EMPTY");
}
+template<>
+template<>
+void object::test<6>() {
+ checkCentroid("POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0), EMPTY)", 0.5, 0.5);
+}
+
} // namespace tut
-----------------------------------------------------------------------
Summary of changes:
NEWS.md | 4 ++++
src/algorithm/Centroid.cpp | 4 ++++
src/geom/IntersectionMatrix.cpp | 2 +-
src/linearref/LengthIndexedLine.cpp | 7 +++++++
src/precision/MinimumClearance.cpp | 4 ++++
tests/unit/algorithm/CentroidTest.cpp | 6 ++++++
tests/unit/capi/GEOSInterpolateTest.cpp | 10 ++++++++++
tests/unit/capi/GEOSLineSubstringTest.cpp | 15 +++++++++++++++
tests/unit/capi/GEOSMinimumClearanceTest.cpp | 10 ++++++++++
tests/unit/capi/GEOSRelatePatternMatchTest.cpp | 13 +++++++++++++
10 files changed, 74 insertions(+), 1 deletion(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list