[geos-commits] [SCM] GEOS branch 3.11 updated. fb471f1bfd933473951012d363a85e4edaf77470

git at osgeo.org git at osgeo.org
Mon Jun 17 11:28:38 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.11 has been updated
       via  fb471f1bfd933473951012d363a85e4edaf77470 (commit)
       via  bfbca811bbe0d586cafd5bc03a0f6ccfa093f111 (commit)
       via  0a38b163dc99c286bcf452aac89b50ab5b0d975f (commit)
       via  29f3002aeb6b5b95c05d78b0c2cc55a2842d29ab (commit)
      from  06fc33c895f5f92a4a43ea660b0cdbfad8914a73 (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 fb471f1bfd933473951012d363a85e4edaf77470
Author: Daniel Baston <dbaston at gmail.com>
Date:   Mon Jun 17 14:25:36 2024 -0400

    NEWS updates

diff --git a/NEWS.md b/NEWS.md
index 211fe9f6f..3e2bf5ee1 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,11 @@
+## Changes in 3.11.5
+20xx-xx-xx
+
+- Fixes/Improvements:
+  - Centroid: Fix crash on polygons with empty holes (GH-1075, Dan Baston)
+  - MinimumClearance: Fix crash on NaN inputs (GH-1082, Dan Baston)
+  - GEOSRelatePatternMatch: Fix crash on invalid DE-9IM pattern (GH-1089, Dan Baston)
+
 ## Changes in 3.11.4
 2024-06-05
 
@@ -10,7 +18,7 @@
   - Fix IsSimpleOp for MultiPoint with empty element (GH-1005, Martin Davis)
   - Fix reading WKT with EMPTY token with white space (GH-1025, Mike Taves)
   - Fix PreparedPolygonContains for GC with MultiPoint (GH-1008, Martin Davis)
-  
+
 ## Changes in 3.11.3
 2023-11-11
 

commit bfbca811bbe0d586cafd5bc03a0f6ccfa093f111
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 0a38b163dc99c286bcf452aac89b50ab5b0d975f
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 532d11195..120e41414 100644
--- a/src/precision/MinimumClearance.cpp
+++ b/src/precision/MinimumClearance.cpp
@@ -178,6 +178,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 29f3002aeb6b5b95c05d78b0c2cc55a2842d29ab
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 6dec14cf5..236d892dc 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[i], pts[i + 1], isPositiveArea);
diff --git a/tests/unit/algorithm/CentroidTest.cpp b/tests/unit/algorithm/CentroidTest.cpp
index 2cf3fab55..be3dcc05e 100644
--- a/tests/unit/algorithm/CentroidTest.cpp
+++ b/tests/unit/algorithm/CentroidTest.cpp
@@ -123,5 +123,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                                        | 10 +++++++++-
 src/algorithm/Centroid.cpp                     |  4 ++++
 src/geom/IntersectionMatrix.cpp                |  2 +-
 src/precision/MinimumClearance.cpp             |  4 ++++
 tests/unit/algorithm/CentroidTest.cpp          |  6 ++++++
 tests/unit/capi/GEOSMinimumClearanceTest.cpp   | 10 ++++++++++
 tests/unit/capi/GEOSRelatePatternMatchTest.cpp | 13 +++++++++++++
 7 files changed, 47 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list