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

git at osgeo.org git at osgeo.org
Thu Dec 10 07:15:40 PST 2020


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  e7caa33f69314fe4e3b9b0cee23eb9ca10ceb932 (commit)
      from  6775f76a442435d45662d20c2e93bb3fe56ba7dd (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 e7caa33f69314fe4e3b9b0cee23eb9ca10ceb932
Author: Sandro Santilli <strk at kbt.io>
Date:   Thu Dec 10 15:41:41 2020 +0100

    Fix crash on relating geoms with empty components
    
    Closes #1085 in 3.6 branch (3.6.4dev)
    Includes tests

diff --git a/NEWS b/NEWS
index 6ec1c06..0cf02c5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,5 @@
 Changes in 3.6.4
-2018-XX-XX
+2020-XX-XX
 
 - Bug fixes / improvements
   - Fix crash in GEOSUnaryUnion with empty LineString
@@ -12,6 +12,7 @@ Changes in 3.6.4
   - Static library does not contain C API (#878)
   - Prevent crash when querying empty STRtree (#730)
   - Overlay performance improvement (#986, Paul Ramsey)
+  - Relate crash with empty components (#1085, Sandro Santilli)
 
 
 Changes in 3.6.3
diff --git a/src/algorithm/PointLocator.cpp b/src/algorithm/PointLocator.cpp
index 0f412a7..9e2ef8a 100644
--- a/src/algorithm/PointLocator.cpp
+++ b/src/algorithm/PointLocator.cpp
@@ -3,12 +3,13 @@
  * GEOS - Geometry Engine Open Source
  * http://geos.osgeo.org
  *
+ * Copyright (C) 2020 Sandro Santilli <strk at kbt.io>
  * Copyright (C) 2005-2011 Refractions Research Inc.
  * Copyright (C) 2001-2002 Vivid Solutions Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU Lesser General Public Licence as published
- * by the Free Software Foundation. 
+ * by the Free Software Foundation.
  * See the COPYING file for more information.
  *
  **********************************************************************
@@ -129,6 +130,7 @@ int
 PointLocator::locate(const Coordinate& p, const LineString *l)
 {
 	const CoordinateSequence* pt=l->getCoordinatesRO();
+	if ( pt->isEmpty() ) return Location::EXTERIOR;
 	if (! l->isClosed()) {
 		if ((p==pt->getAt(0)) || (p==pt->getAt(pt->getSize()-1))) {
 			return Location::BOUNDARY;
@@ -147,7 +149,7 @@ PointLocator::locateInPolygonRing(const Coordinate& p, const LinearRing *ring)
 
 	const CoordinateSequence *cl = ring->getCoordinatesRO();
 
-	if (CGAlgorithms::isOnLine(p,cl)) 
+	if (CGAlgorithms::isOnLine(p,cl))
 		return Location::BOUNDARY;
 	if (CGAlgorithms::isPointInRing(p,cl))
 		return Location::INTERIOR;
diff --git a/tests/xmltester/Makefile.am b/tests/xmltester/Makefile.am
index 00c1dc4..cbd6147 100644
--- a/tests/xmltester/Makefile.am
+++ b/tests/xmltester/Makefile.am
@@ -45,6 +45,7 @@ SAFE_XMLTESTS=$(srcdir)/tests/testLeaksBig.xml \
 	$(srcdir)/tests/ticket/bug716.xml \
 	$(srcdir)/tests/ticket/bug837.xml \
 	$(srcdir)/tests/ticket/bug838.xml \
+	$(srcdir)/tests/ticket/bug1085.xml \
 	$(srcdir)/tests/general/TestBoundary.xml \
 	$(srcdir)/tests/general/TestBuffer.xml \
 	$(srcdir)/tests/general/TestBufferMitredJoin.xml \
diff --git a/tests/xmltester/tests/ticket/bug1085.xml b/tests/xmltester/tests/ticket/bug1085.xml
new file mode 100644
index 0000000..00c180d
--- /dev/null
+++ b/tests/xmltester/tests/ticket/bug1085.xml
@@ -0,0 +1,19 @@
+<run>
+  <precisionModel />
+
+<case>
+<desc>
+Empty component in multilinestring
+See https://trac.osgeo.org/geos/ticket/1085
+</desc>
+  <a>
+    LINESTRING(0 0, 10 0)
+  </a>
+  <b>
+    MULTILINESTRING((0 10,10 -10),EMPTY)
+  </b>
+<test><op name="relate" arg3="0F1FF0102" arg1="A" arg2="B">true </op> </test>
+</case>
+
+
+</run>

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

Summary of changes:
 NEWS                                     |  3 ++-
 src/algorithm/PointLocator.cpp           |  6 ++++--
 tests/xmltester/Makefile.am              |  1 +
 tests/xmltester/tests/ticket/bug1085.xml | 19 +++++++++++++++++++
 4 files changed, 26 insertions(+), 3 deletions(-)
 create mode 100644 tests/xmltester/tests/ticket/bug1085.xml


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list