[geos-commits] [SCM] GEOS branch 3.7 updated. 3afc83d36f6d60da747b475d3223d8268f53e3f1

git at osgeo.org git at osgeo.org
Fri Sep 21 04:58:08 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  3afc83d36f6d60da747b475d3223d8268f53e3f1 (commit)
       via  3d7a9e859697d028b85f16de9a27d16b5ecabc4a (commit)
      from  f99c6c66ad69f3c3eb17f306e697169fab9607dd (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 3afc83d36f6d60da747b475d3223d8268f53e3f1
Merge: 3d7a9e8 f99c6c6
Author: Daniel Baston <dbaston at gmail.com>
Date:   Fri Sep 21 07:57:36 2018 -0400

    Merge branch '3.7' of https://git.osgeo.org/gitea/geos/geos into 3.7


commit 3d7a9e859697d028b85f16de9a27d16b5ecabc4a
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/NEWS b/NEWS
index 54b7e53..f4519c7 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+Changes in 3.7.1
+2018-XX-XX
+
+- Bug fixes / improvements
+  - Fix crash in GEOSCoordSeq_isCCW with empty coordseq
+    (#927, Sergey Fedoseev)
+
+
 3.7.0 changes
 2018-09-10
 - New things:
diff --git a/src/algorithm/CGAlgorithms.cpp b/src/algorithm/CGAlgorithms.cpp
index 29154ac..1110141 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);
 	int 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:
 NEWS                                 |  8 ++++++++
 src/algorithm/CGAlgorithms.cpp       |  8 ++++----
 tests/unit/capi/GEOSCoordSeqTest.cpp | 10 ++++++++++
 3 files changed, 22 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list