[geos-commits] [SCM] GEOS branch master updated. b578411ff0434fe0397fe4a0ecad727c5e41e825

git at osgeo.org git at osgeo.org
Fri Sep 21 04:51:55 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  b578411ff0434fe0397fe4a0ecad727c5e41e825 (commit)
       via  9ba8f5ee2516c39c1037442383182b846b15ed3b (commit)
       via  7a5f23ab15b45041271cc2c34852ea08689cfa3a (commit)
      from  93932020d371a2fc571dd9141328b751bf8f0272 (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 b578411ff0434fe0397fe4a0ecad727c5e41e825
Merge: 9393202 9ba8f5e
Author: Daniel Baston <dbaston at gmail.com>
Date:   Fri Sep 21 07:51:37 2018 -0400

    Merge branch 'sir-sigurd-empty-crash-isccw'


commit 9ba8f5ee2516c39c1037442383182b846b15ed3b
Merge: 9393202 7a5f23a
Author: Daniel Baston <dbaston at gmail.com>
Date:   Fri Sep 21 07:51:19 2018 -0400

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


commit 7a5f23ab15b45041271cc2c34852ea08689cfa3a
Author: Sergey Fedoseev <fedoseev.sergey at gmail.com>
Date:   Fri Sep 21 01:34:07 2018 +0500

    Fix #927 -- Fixed crash in GEOSCoordSeq_isCCW() when used with empty coordseq.

diff --git a/src/algorithm/CGAlgorithms.cpp b/src/algorithm/CGAlgorithms.cpp
index f425a1b..8b62a77 100644
--- a/src/algorithm/CGAlgorithms.cpp
+++ b/src/algorithm/CGAlgorithms.cpp
@@ -99,15 +99,15 @@ CGAlgorithms::isOnLine(const Coordinate& p, const CoordinateSequence* pt)
 bool
 CGAlgorithms::isCCW(const CoordinateSequence* ring)
 {
-	// # of points without closing endpoint
-	const std::size_t nPts=ring->getSize()-1;
-
 	// sanity check
-	if (nPts < 3)
+	if (ring->getSize() < 4)
 	{
 		throw util::IllegalArgumentException("Ring has fewer than 3 points, so orientation cannot be determined");
 	}
 
+	// # of points without closing endpoint
+	const std::size_t nPts=ring->getSize()-1;
+
 	// find highest point
 	const Coordinate *hiPt=&ring->getAt(0);
 	size_t hiIndex = 0;
diff --git a/tests/unit/capi/GEOSCoordSeqTest.cpp b/tests/unit/capi/GEOSCoordSeqTest.cpp
index 54af433..ff9324a 100644
--- a/tests/unit/capi/GEOSCoordSeqTest.cpp
+++ b/tests/unit/capi/GEOSCoordSeqTest.cpp
@@ -322,5 +322,15 @@ namespace tut
         ensure_equals(GEOSCoordSeq_isCCW(cs_, &ccw), 0);
     }
 
+    template<>
+    template<>
+    void object::test<10>() {
+        // no orientation
+        cs_ = GEOSCoordSeq_create(0, 0);
+        char ccw;
+
+        ensure_equals(GEOSCoordSeq_isCCW(cs_, &ccw), 0);
+    }
+
 } // namespace tut
 

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

Summary of changes:
 src/algorithm/CGAlgorithms.cpp       |  8 ++++----
 tests/unit/capi/GEOSCoordSeqTest.cpp | 10 ++++++++++
 2 files changed, 14 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list