[geos-commits] [SCM] GEOS branch 3.7 updated. cf33db7424c7e6f3e3b6b91ff6f0209b0cd6263f

git at osgeo.org git at osgeo.org
Sun Sep 23 18:34:58 PDT 2018


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.7 has been updated
       via  cf33db7424c7e6f3e3b6b91ff6f0209b0cd6263f (commit)
      from  2f12a8026afb67431a3d2dc22f34630911b4e226 (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 cf33db7424c7e6f3e3b6b91ff6f0209b0cd6263f
Author: Sergey Fedoseev <fedoseev.sergey at gmail.com>
Date:   Fri Sep 21 01:34:07 2018 +0500

    Fix #928: Fixed crash in GEOSUnaryUnion() when used with empty linestring.

diff --git a/NEWS b/NEWS
index 1e9973e..bb34a90 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ Changes in 3.7.1
     (#927, Sergey Fedoseev)
   - Fix crash in GEOSInterpolate with empty LineString
     (#926, Sergey Fedoseev)
+  - Fix crash in GEOSUnaryUnion with empty LineString
+    (#928, Sergey Fedoseev)
 
 
 3.7.0 changes
diff --git a/src/operation/union/UnaryUnionOp.cpp b/src/operation/union/UnaryUnionOp.cpp
index 5a1cd6d..98ef035 100644
--- a/src/operation/union/UnaryUnionOp.cpp
+++ b/src/operation/union/UnaryUnionOp.cpp
@@ -93,7 +93,9 @@ UnaryUnionOp::Union()
        */
       unionLines.reset( CascadedUnion::Union( lines.begin(),
                                               lines.end()   ) );
-      unionLines = unionNoOpt(*unionLines);
+      if (unionLines.get()) {
+          unionLines = unionNoOpt(*unionLines);
+      }
   }
 
   GeomPtr unionPolygons;
diff --git a/tests/unit/capi/GEOSUnaryUnionTest.cpp b/tests/unit/capi/GEOSUnaryUnionTest.cpp
index b2efa0a..f3155bf 100644
--- a/tests/unit/capi/GEOSUnaryUnionTest.cpp
+++ b/tests/unit/capi/GEOSUnaryUnionTest.cpp
@@ -207,5 +207,18 @@ namespace tut
 
     }
 
+    // Self-union an empty linestring
+    template<>
+    template<>
+    void object::test<10>()
+    {
+        geom1_ = GEOSGeomFromWKT("LINESTRING EMPTY");
+        ensure( nullptr != geom1_ );
+
+        geom2_ = GEOSUnaryUnion(geom1_);
+        ensure( nullptr != geom2_ );
+
+        ensure_equals(toWKT(geom2_), std::string("GEOMETRYCOLLECTION EMPTY"));
+    }
 } // namespace tut
 
diff --git a/tests/unit/operation/union/UnaryUnionOpTest.cpp b/tests/unit/operation/union/UnaryUnionOpTest.cpp
index 10a537c..0f2e729 100644
--- a/tests/unit/operation/union/UnaryUnionOpTest.cpp
+++ b/tests/unit/operation/union/UnaryUnionOpTest.cpp
@@ -179,5 +179,17 @@ namespace tut
         doTest(geoms, "MULTILINESTRING ((0 0, 5 0), (5 0, 10 0, 5 -5, 5 0), (5 0, 5 5))");
     }
 
+    template<>
+    template<>
+    void object::test<7>()
+    {
+        static char const* const geoms[] =
+        {
+            "LINESTRING EMPTY",
+            nullptr
+        };
+        doTest(geoms, "GEOMETRYCOLLECTION EMPTY");
+    }
+
 } // namespace tut
 

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

Summary of changes:
 NEWS                                            |  2 ++
 src/operation/union/UnaryUnionOp.cpp            |  4 +++-
 tests/unit/capi/GEOSUnaryUnionTest.cpp          | 13 +++++++++++++
 tests/unit/operation/union/UnaryUnionOpTest.cpp | 12 ++++++++++++
 4 files changed, 30 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list