[geos-commits] [SCM] GEOS branch main updated. 72a731ad7aab986f8f1b2b5074453685fc46343b

git at osgeo.org git at osgeo.org
Tue May 21 10:14:18 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, main has been updated
       via  72a731ad7aab986f8f1b2b5074453685fc46343b (commit)
       via  86ca4cbfb9a08348d2d3ba1359fee792ffa27dd5 (commit)
      from  5bf67e6ff8599a7eef8ccbe8f02945a4a4e9dfa0 (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 72a731ad7aab986f8f1b2b5074453685fc46343b
Author: Daniel Baston <dbaston at gmail.com>
Date:   Tue Apr 30 18:38:10 2024 -0400

    GEOSRelatePattern: Add some tests with invalid patterns

diff --git a/tests/unit/capi/GEOSRelatePatternTest.cpp b/tests/unit/capi/GEOSRelatePatternTest.cpp
index 1b6068749..819e6ad79 100644
--- a/tests/unit/capi/GEOSRelatePatternTest.cpp
+++ b/tests/unit/capi/GEOSRelatePatternTest.cpp
@@ -33,7 +33,7 @@ void object::test<1>()
 
 template<>
 template<>
-void object::test<11>()
+void object::test<2>()
 {
     geom1_ = fromWKT("CIRCULARSTRING (0 0, 1 1, 2 0)");
     geom2_ = fromWKT("LINESTRING (1 0, 2 1)");
@@ -45,5 +45,26 @@ void object::test<11>()
     ensure_equals("curved geometry not supported", GEOSRelatePattern(geom2_, geom1_, "0********"), 2);
 }
 
+// invalid DE-9IM
+template<>
+template<>
+void object::test<3>()
+{
+    geom1_ = fromWKT("POINT(1 2)");
+    geom2_ = fromWKT("POINT(1 2)");
+
+    ensure(geom1_);
+    ensure(geom2_);
+
+    // pattern too long
+    ensure_equals(2, GEOSRelatePattern(geom1_, geom2_, "0FFFFF2120000000000000000000"));
+
+    // pattern too short
+    ensure_equals(2, GEOSRelatePattern(geom1_, geom2_, "0F"));
+
+    // pattern has invalid characters
+    ensure_equals(0, GEOSRelatePattern(geom1_, geom2_, "123456789"));
+}
+
 } // namespace tut
 

commit 86ca4cbfb9a08348d2d3ba1359fee792ffa27dd5
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
 

-----------------------------------------------------------------------

Summary of changes:
 src/geom/IntersectionMatrix.cpp                |  2 +-
 tests/unit/capi/GEOSRelatePatternMatchTest.cpp | 13 +++++++++++++
 tests/unit/capi/GEOSRelatePatternTest.cpp      | 23 ++++++++++++++++++++++-
 3 files changed, 36 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list