[geos-commits] [SCM] GEOS branch svn-3.5 updated. 5e490724af7c97c9ca3fca8292e12ef3be40afbb

git at osgeo.org git at osgeo.org
Sun Sep 23 18:42:47 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.5 has been updated
       via  5e490724af7c97c9ca3fca8292e12ef3be40afbb (commit)
      from  46987a89b59af10affa494c1432d12fb61a43ac9 (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 5e490724af7c97c9ca3fca8292e12ef3be40afbb
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 0f521d4..11e5306 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+Changes in 3.5.3
+2018-XX-XX
+
+-Bug fixes / improvements
+  - Fix crash in GEOSUnaryUnion with empty LineString (#928, Sergey Fedoseev)
+
 Changes in 3.5.2
 2018-08-06
 
@@ -38,14 +44,14 @@ Changes in 3.4.2
 2013-08-25
 
 - Bug fixes / improvements
-  - Use a double for PrecisionModel scale, avoiding overflows 
+  - Use a double for PrecisionModel scale, avoiding overflows
     should fix 32-bit regression failures (#652)
   - isnan workaround OS detection missing NetBSD, DragonFly, Sun nuance (#650)
   - Do not distribute platform.h and version.h, but install both (#601)
-  - Non-standard ChangeLog file in 3.4.0 and 3.4.1 releases (#654) 
+  - Non-standard ChangeLog file in 3.4.0 and 3.4.1 releases (#654)
   - new travis bot (#657)
   - accept multiple Nan representations (#656)
-		
+
 
 Changes in 3.4.1
 2013-08-17
@@ -72,7 +78,7 @@ Changes in 3.4.0
 
 - C++ API changes:
   - New noding::GeometryNoder class
-  - Added BufferOp::setSingleSided 
+  - Added BufferOp::setSingleSided
   - Signature of most functions taking a Label changed to take it
     by reference rather than pointer.
   - Signature of most functions taking an IntersectionMatrix changed
@@ -80,13 +86,13 @@ Changes in 3.4.0
   - GraphComponent::label is now a Label value (from a pointer)
   - NodedSegmentString takes ownership of CoordinateSenuence now
   - io::Writer's toString() returns by const ref, write() takes a const ref
-  - Unify prototypes of WKTReader and WKBReader constructor (#310) 
-  - GeometryCollection::computeEnvelopInternal and 
+  - Unify prototypes of WKTReader and WKBReader constructor (#310)
+  - GeometryCollection::computeEnvelopInternal and
     GeometryCollection::compareToSameClass are marked virtual (#478)
-  
+
 - Bug fixes / improvements
-  - A point interpolated from a line does not always intersect 
-    the same line (#323) 
+  - A point interpolated from a line does not always intersect
+    the same line (#323)
   - Port ConvexHull robustness fix from JTS-1.13 (#457)
   - Improve Overlay robustness by reducing input precision on topology
     exception and by refusing to accept unnoded output (#459)
@@ -100,7 +106,7 @@ Changes in 3.4.0
   - Fix EMPTY return from single-point lines and zero-length polygons (#612)
   - CMakeLists.txt, tools/geos_svn_revision_cmake.h.in: Add
 	  geos_svn_revision.h generator to CMake config (#643)
-	- Makefile.vc 'clean' step leaks obj files (#607) 
+	- Makefile.vc 'clean' step leaks obj files (#607)
 
 Changes in 3.3.9
 2013-09-04
@@ -117,7 +123,7 @@ Changes in 3.3.9
     - Fix bug in HotPixel constructor (#635)
     - Fix install location of linearref headers (#624)
     - Fix multi-geometry constructor to drop SRID from components (#583)
-  
+
 Changes in 3.3.8
 2013-02-28
 
@@ -128,7 +134,7 @@ Changes in 3.3.8
     - Fix centroid computation for collections with empty components (#582)
 
 Changes in 3.3.7
-2013-01-22 
+2013-01-22
 
 - Bug fixes / improvements
     - Fix abort in RightmostEdgeFinder (#605)
@@ -227,10 +233,10 @@ Changes in 3.3.0
           the polygonizer
   - CAPI: GEOSOrientationIndex
   - CAPI: GEOSSharedPaths to find shared paths and their orientation
-  - CAPI: GEOSSnap 
-  - CAPI: GEOSRelatePatternMatch 
-  - CAPI: GEOSCovers, GEOSCoveredBy (#396) 
-  - CAPI: GEOSRelateBoundaryNodeRule (#399) 
+  - CAPI: GEOSSnap
+  - CAPI: GEOSRelatePatternMatch
+  - CAPI: GEOSCovers, GEOSCoveredBy (#396)
+  - CAPI: GEOSRelateBoundaryNodeRule (#399)
   - CAPI: GEOSGeom_getCoordinateDimension() (#311)
   - CAPI: GEOSWKTWriter_setOutputDimension, GEOSWKTWriter_setOld3D (#292)
   -  PHP: new PHP5 bindings based on CAPI
@@ -253,13 +259,13 @@ Changes in 3.3.0
   - Fix NodedSegmentString to handle zero-length line segments correctly
     (via safeOctant)
   - Fixed buffer OffsetCurveSetBuilder to handle "flat" rings correctly
-  - Added illegal state check in LineSegment::pointAlongOffset() 
+  - Added illegal state check in LineSegment::pointAlongOffset()
   - Improved performance of RectangleIntersects by always using
     segment-scanning and refining SegmentIntersectionTester
   - Reduce memory use in PreparedGeometry predicates (#342)
   - Fix infinite loop in RobustDeterminant with nan/inf input (#357)
 
-Changes in 3.2.0 
+Changes in 3.2.0
 2009-12-14
 
 - Add Single-sided buffer operation
@@ -281,7 +287,7 @@ Changes in 3.1.0
 
 - PreparedGeometry operations for very fast predicate testing.
   - Intersects()
-  - Covers() 
+  - Covers()
   - CoveredBy()
   - ContainsProperly()
 - Easier builds under MSVC and OpenSolaris
@@ -308,7 +314,7 @@ Changes in 3.0.0
 	- Added GEOSSimplify() and GEOSTopologyPreserveSimplify()
 	  to the C API
 	- Added closed ring checks in IsValidOp
-	- Multi-input support in XMLTester 
+	- Multi-input support in XMLTester
 	- HEXWKB I/O
 	- Envelope(string) ctor
 	- Ruby interface
@@ -357,7 +363,7 @@ Changes in 3.0.0
 	  contains() ops
 	- Inlined all planarGraphComponent class
 	- More iterators returning methods and inlining in planargraph.
-	- Obsoleted toInternalGeometry/fromInternalGeometry 
+	- Obsoleted toInternalGeometry/fromInternalGeometry
 	- Improved buffering speed and robustness by using Snap Rounding
 
 - Semantic changes
@@ -403,7 +409,7 @@ Changes in 3.0.0
 	  result of overlaying polygons containing touching holes (#13)
 	- Fixed integer conversion bug
 	- Fixed PointLocator handling of LinearRings
-	- Added missing ::clone() methods for Multi* geoms 
+	- Added missing ::clone() methods for Multi* geoms
 
 - (Partial) Detailed list of changes:
 	- Changed SegmentNode to contain a *real* Coordinate (not a pointer)
@@ -427,7 +433,7 @@ Changes in 3.0.0
 	- CoordinateSequence API changes:
 		- point index and size related functions
 	  	  use unsigned int rather then int
-	- Changed EdgeEndStar to maintain a single container for EdgeEnds 
+	- Changed EdgeEndStar to maintain a single container for EdgeEnds
 	- Changed PlanarGraph::addEdges to take a const vector by ref
 	  rathern then a non-const vector by pointer
 	- Changed EdgeList::addAll to take a const vector by ref
@@ -452,17 +458,17 @@ Changes in 2.2.1
 
 - Support for MingW builds
 - Bugfix in Polygonizer chocking on invalid LineString inputs
-- CAPI: small leak removed in GEOSHasZ() 
+- CAPI: small leak removed in GEOSHasZ()
 
 Changes in 2.2.0
 
 - Performance improvement in OverlayOp::insertUniqueEdge()
 - CoordinateSequence copy removal in EdgeRing
-- Minor memory allocation improvements 
+- Minor memory allocation improvements
 - Higher dimensions interface for CoordinateSequence
 - Added getCoordinatesRO for Point class
 - NEW WKB IO
-- NEW Simplified and stabler C API 
+- NEW Simplified and stabler C API
 
 Changes in 2.1.4
 
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 09bd48b..18e7a5e 100644
--- a/tests/unit/operation/union/UnaryUnionOpTest.cpp
+++ b/tests/unit/operation/union/UnaryUnionOpTest.cpp
@@ -178,5 +178,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                                            | 58 ++++++++++++++-----------
 src/operation/union/UnaryUnionOp.cpp            |  4 +-
 tests/unit/capi/GEOSUnaryUnionTest.cpp          | 13 ++++++
 tests/unit/operation/union/UnaryUnionOpTest.cpp | 12 +++++
 4 files changed, 60 insertions(+), 27 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list