[geos-commits] [SCM] GEOS branch master updated. 1c51df2bce96fb801d4c75cfdd99d4ee34fa7aa8

git at osgeo.org git at osgeo.org
Sun Sep 23 18:33:05 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, master has been updated
       via  1c51df2bce96fb801d4c75cfdd99d4ee34fa7aa8 (commit)
       via  d5141be7fb1a427e9939eb6024dafedfa6df22f3 (commit)
       via  2af4f0637282ea05e6724d3ea029dbaff6e8c827 (commit)
      from  52c516f3682c9ae4effc957aebc89176eacfac49 (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 1c51df2bce96fb801d4c75cfdd99d4ee34fa7aa8
Merge: 52c516f d5141be
Author: Daniel Baston <dbaston at gmail.com>
Date:   Sun Sep 23 21:32:20 2018 -0400

    Merge branch 'sir-sigurd-empty-crash-unary-union'


commit d5141be7fb1a427e9939eb6024dafedfa6df22f3
Merge: 52c516f 2af4f06
Author: Daniel Baston <dbaston at gmail.com>
Date:   Sun Sep 23 21:32:00 2018 -0400

    Merge branch 'empty-crash-unary-union' of https://github.com/sir-sigurd/libgeos into sir-sigurd-empty-crash-unary-union


commit 2af4f0637282ea05e6724d3ea029dbaff6e8c827
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/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:
 src/operation/union/UnaryUnionOp.cpp            |  4 +++-
 tests/unit/capi/GEOSUnaryUnionTest.cpp          | 13 +++++++++++++
 tests/unit/operation/union/UnaryUnionOpTest.cpp | 12 ++++++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list