[geos-commits] [SCM] GEOS branch main updated. b54d1466e1c699f418770a4176ceb12d3cf7c6c6

git at osgeo.org git at osgeo.org
Tue Jun 30 11:58:14 PDT 2026


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  b54d1466e1c699f418770a4176ceb12d3cf7c6c6 (commit)
      from  f603af8de7618ab110c661da4896e651f5e44ecb (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 b54d1466e1c699f418770a4176ceb12d3cf7c6c6
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Tue Jun 30 11:57:51 2026 -0700

    GeometrySplitter: Fix crash splitting by 3D multi-part geometry (#1462)
    
    Repairs some issues in the flag/geometry type caching in GeometrySplitter, adds relevant test case.

diff --git a/include/geos/geom/GeometryCollection.h b/include/geos/geom/GeometryCollection.h
index 1fd3826bb..8d147c396 100644
--- a/include/geos/geom/GeometryCollection.h
+++ b/include/geos/geom/GeometryCollection.h
@@ -265,6 +265,7 @@ protected:
 
     void geometryChangedAction() override {
         envelope.setToNull();
+        flags.flagsCalculated = false;
     }
 
     int compareToSameClass(const Geometry* gc) const override;
diff --git a/src/geom/GeometryCollection.cpp b/src/geom/GeometryCollection.cpp
index 8071260fe..d2dab2733 100644
--- a/src/geom/GeometryCollection.cpp
+++ b/src/geom/GeometryCollection.cpp
@@ -150,6 +150,15 @@ GeometryCollection::setFlags() const {
         return;
     }
 
+    // Reset before accumulating, otherwise stale values (e.g. carried over
+    // by a clone) would never clear once flagsCalculated is invalidated.
+    flags.hasPoints = false;
+    flags.hasLines = false;
+    flags.hasPolygons = false;
+    flags.hasM = false;
+    flags.hasZ = false;
+    flags.hasCurves = false;
+
     for (const auto& geom : geometries) {
         flags.hasPoints |= geom->hasDimension(Dimension::P);
         flags.hasLines |= geom->hasDimension(Dimension::L);
diff --git a/src/operation/split/GeometrySplitter.cpp b/src/operation/split/GeometrySplitter.cpp
index 904f01081..0331cd033 100644
--- a/src/operation/split/GeometrySplitter.cpp
+++ b/src/operation/split/GeometrySplitter.cpp
@@ -131,22 +131,24 @@ class RemoveCoordinateZM : public geom::CoordinateSequenceFilter {
 
 public:
 
-    void filter_rw(geom::CoordinateSequence& seq, std::size_t) override {
-        seq.setZM(false, false);
-        m_done = true;
+    void filter_rw(geom::CoordinateSequence& seq, std::size_t i) override {
+        // setZM rewrites the entire sequence, so we only need to act once
+        // per sequence (at the first coordinate).
+        if (i == 0) {
+            seq.setZM(false, false);
+        }
     }
 
     bool isDone() const override {
-        return m_done;
-    }
-
-    bool isGeometryChanged() const override {
-        // We didn't change the XY coords; no need to update the envelope.
+        // We must visit every sequence in the geometry, so never stop early.
         return false;
     }
 
-private:
-    bool m_done{false};
+    bool isGeometryChanged() const override {
+        // We dropped the Z/M dimensions, so cached dimensional flags
+        // must be recomputed.
+        return true;
+    }
 };
 
 std::unique_ptr<Geometry>
diff --git a/tests/unit/operation/split/GeometrySplitterTest.cpp b/tests/unit/operation/split/GeometrySplitterTest.cpp
index 2fa6f7767..66f06ffa7 100644
--- a/tests/unit/operation/split/GeometrySplitterTest.cpp
+++ b/tests/unit/operation/split/GeometrySplitterTest.cpp
@@ -870,4 +870,18 @@ void object::test<71>()
               "GEOMETRYCOLLECTION(COMPOUNDCURVE ((-10 0, -5 0), CIRCULARSTRING (-5 0, 0 5, 5 0), (5 0, 10 0)))");
 }
 
+
+template<>
+template<>
+void object::test<72>()
+{
+    set_test_name("split LineString with 3D MultiLineString edge");
+
+    testSplit("LINESTRING(-11.1111111 70,70 -11.1111111)",
+              "MULTILINESTRING((-10 40 1,-9 41 1),(-9 41 1,-8 42 2),(-10 65 1,-9 66 1),(-9 66 1,-8 67 2),(10 40 1,11 41 1),(11 41 1,12 42 2),(10 65 1,11 66 1),(11 66 1,12 67 2),(30 40 1,31 41 1),(31 41 1,32 42 2),(30 65 1,31 66 1),(31 66 1,32 67 2),(50 40 1,51 41 1),(51 41 1,52 42 2),(50 65 1,51 66 1),(51 66 1,52 67 2))",
+              "GEOMETRYCOLLECTION (LINESTRING (-11.1111111 70, -8.055555550000001 66.94444445), LINESTRING (-8.055555550000001 66.94444445, 70 -11.1111111))");
+}
+
+
+
 }

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

Summary of changes:
 include/geos/geom/GeometryCollection.h              |  1 +
 src/geom/GeometryCollection.cpp                     |  9 +++++++++
 src/operation/split/GeometrySplitter.cpp            | 20 +++++++++++---------
 tests/unit/operation/split/GeometrySplitterTest.cpp | 14 ++++++++++++++
 4 files changed, 35 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list