[geos-commits] r4334 - in trunk/src: algorithm operation/overlay
Sandro Santilli
strk at kbt.io
Tue Feb 14 08:27:42 PST 2017
Author: strk
Date: 2017-02-14 08:27:42 -0800 (Tue, 14 Feb 2017)
New Revision: 4334
Modified:
trunk/src/algorithm/LineIntersector.cpp
trunk/src/operation/overlay/OverlayOp.cpp
Log:
Protect from computations against NaN numbers
Fixes an unhandled exception:
0xC0000090: Floating-point invalid operation.
Closes #811 - thanks sunxunfeng
Modified: trunk/src/algorithm/LineIntersector.cpp
===================================================================
--- trunk/src/algorithm/LineIntersector.cpp 2017-02-14 16:27:33 UTC (rev 4333)
+++ trunk/src/algorithm/LineIntersector.cpp 2017-02-14 16:27:42 UTC (rev 4334)
@@ -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: trunk/src/operation/overlay/OverlayOp.cpp
===================================================================
--- trunk/src/operation/overlay/OverlayOp.cpp 2017-02-14 16:27:33 UTC (rev 4333)
+++ trunk/src/operation/overlay/OverlayOp.cpp 2017-02-14 16:27:42 UTC (rev 4334)
@@ -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