[geos-commits] [SCM] GEOS branch svn-3.6 updated. 35906587bfe4ee83a3f406801d98c3c34b533589

git at osgeo.org git at osgeo.org
Sun Sep 23 18:36:38 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, svn-3.6 has been updated
       via  35906587bfe4ee83a3f406801d98c3c34b533589 (commit)
      from  0680a65700e22e6ebd09fdd4ebbe33fcd8a20bd1 (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 35906587bfe4ee83a3f406801d98c3c34b533589
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 6feabac..8d63ff7 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+Changes in 3.6.4
+2018-XX-XX
+
+- Bug fixes / improvements
+  - Fix crash in GEOSUnaryUnion with empty LineString
+    (#928, Sergey Fedoseev)
+
+
 Changes in 3.6.3
 2018-08-06
 
diff --git a/src/operation/union/UnaryUnionOp.cpp b/src/operation/union/UnaryUnionOp.cpp
index 59609ec..655bbc6 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);
+      }
   }
 
   GeomAutoPtr unionPolygons;
diff --git a/tests/unit/capi/GEOSUnaryUnionTest.cpp b/tests/unit/capi/GEOSUnaryUnionTest.cpp
index 6f4a689..0f7705d 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 38a098b..1e14a66 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                                            |  8 ++++++++
 src/operation/union/UnaryUnionOp.cpp            |  4 +++-
 tests/unit/capi/GEOSUnaryUnionTest.cpp          | 13 +++++++++++++
 tests/unit/operation/union/UnaryUnionOpTest.cpp | 12 ++++++++++++
 4 files changed, 36 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list