From c056c7db40ca458f0e67b013ee344895e1461ace Mon Sep 17 00:00:00 2001 From: mkazhdan Date: Thu, 12 Nov 2015 22:30:11 -0500 Subject: [PATCH] Memory Access Out of Bounds Fix Added a necessary check to avoid out-of-bounds memory access. (Bug caught by Daniel G.) --- Src/MultiGridOctreeData.IsoSurface.inl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Src/MultiGridOctreeData.IsoSurface.inl b/Src/MultiGridOctreeData.IsoSurface.inl index e81969d..53e6df2 100644 --- a/Src/MultiGridOctreeData.IsoSurface.inl +++ b/Src/MultiGridOctreeData.IsoSurface.inl @@ -268,8 +268,11 @@ Real Octree< Real >::GetIsoValue( const DenseNodeData< Real , FEMDegree >& solut } nodeValues[i] = value; int idx = nodeWeights.index( _sNodes.treeNodes[i] ); - Real w = nodeWeights.data[ idx ]; - if( w!=0 ) isoValue += value * w , weightSum += w; + if( idx!=-1 ) + { + Real w = nodeWeights.data[ idx ]; + if( w!=0 ) isoValue += value * w , weightSum += w; + } } } metSolution.resize( 0 );