[geos-commits] r4335 - in branches/3.6: . src/algorithm src/operation/overlay

Sandro Santilli strk at kbt.io
Tue Feb 14 08:36:11 PST 2017


Author: strk
Date: 2017-02-14 08:36:11 -0800 (Tue, 14 Feb 2017)
New Revision: 4335

Modified:
   branches/3.6/NEWS
   branches/3.6/src/algorithm/LineIntersector.cpp
   branches/3.6/src/operation/overlay/OverlayOp.cpp
Log:
Protect from computations against NaN numbers

Fixes an unhandled exception:
0xC0000090: Floating-point invalid operation.

Closes #811 for 3.6 branch - thanks sunxunfeng

Modified: branches/3.6/NEWS
===================================================================
--- branches/3.6/NEWS	2017-02-14 16:27:42 UTC (rev 4334)
+++ branches/3.6/NEWS	2017-02-14 16:36:11 UTC (rev 4335)
@@ -5,6 +5,7 @@
   - Allow building against python 3 (#774)
   - Fix build with android-ndk and other compilers (#799)
   - Allows compiling with -Wpointer-bool-conversion (#638)
+  - Fix unhandled exception on invalid fp operation (#811)
 
 Changes in 3.6.1
 2016-12-24

Modified: branches/3.6/src/algorithm/LineIntersector.cpp
===================================================================
--- branches/3.6/src/algorithm/LineIntersector.cpp	2017-02-14 16:27:42 UTC (rev 4334)
+++ branches/3.6/src/algorithm/LineIntersector.cpp	2017-02-14 16:36:11 UTC (rev 4335)
@@ -871,6 +871,11 @@
 	n11.x -= normPt.x;    n11.y -= normPt.y;
 
 #if COMPUTE_Z
+
+	// Only do this if input does have Z
+	// See https://trac.osgeo.org/geos/ticket/811
+	if( ISNAN(n00.z) ) return;
+
 	double minZ0 = n00.z < n01.z ? n00.z : n01.z;
 	double minZ1 = n10.z < n11.z ? n10.z : n11.z;
 	double maxZ0 = n00.z > n01.z ? n00.z : n01.z;

Modified: branches/3.6/src/operation/overlay/OverlayOp.cpp
===================================================================
--- branches/3.6/src/operation/overlay/OverlayOp.cpp	2017-02-14 16:27:42 UTC (rev 4334)
+++ branches/3.6/src/operation/overlay/OverlayOp.cpp	2017-02-14 16:36:11 UTC (rev 4335)
@@ -425,6 +425,11 @@
 	 * by LineIntersector invoked by CGAlgorithms::isOnLine
 	 * invoked by PointLocator.
 	 */
+
+	// Only do this if input does have Z
+	// See https://trac.osgeo.org/geos/ticket/811
+	if(targetGeom->getCoordinateDimension() < 3 ) return;
+
 	const LineString *line = dynamic_cast<const LineString *>(targetGeom);
 	if ( loc == Location::INTERIOR && line )
 	{



More information about the geos-commits mailing list