Salome HOME
0019957: EDF 785 SMESH: Convert Quadratic and Group on GEOM
authorvsr <vsr@opencascade.com>
Fri, 14 Oct 2011 15:09:47 +0000 (15:09 +0000)
committervsr <vsr@opencascade.com>
Fri, 14 Oct 2011 15:09:47 +0000 (15:09 +0000)
Avoid endless recursing in FindCoincidentNodes() function (causing crash)

src/SMESHUtils/SMESH_OctreeNode.cxx

index f735011e6ea84b6a0bf94e64e0a705016def0008..ddaac892b388c01165f8178e68c4663b189219fb 100644 (file)
@@ -249,7 +249,9 @@ void SMESH_OctreeNode::FindCoincidentNodes (TIDSortedNodeSet& theSetOfNodes,
                                             const int maxLevel,
                                             const int maxNbNodes)
 {
-  SMESH_OctreeNode theOctreeNode(theSetOfNodes, maxLevel, maxNbNodes, theTolerance);
+  // VSR 14/10/2011: limit max number of the levels in order to avoid endless recursing
+  const int MAX_LEVEL = 10;
+  SMESH_OctreeNode theOctreeNode(theSetOfNodes, maxLevel < 0 ? MAX_LEVEL : maxLevel, maxNbNodes, theTolerance);
   theOctreeNode.FindCoincidentNodes (&theSetOfNodes, theTolerance, theGroupsOfNodes);
 }