]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix crash when walking out of array boundaries (issue #1178)
authorazv <azv@opencascade.com>
Fri, 25 Dec 2015 07:15:17 +0000 (10:15 +0300)
committerazv <azv@opencascade.com>
Fri, 25 Dec 2015 07:15:17 +0000 (10:15 +0300)
src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.cpp
src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp

index a7a83a13d91a1be1a282572b8fc63fa3d9615862..b2a475f23aed54fb39955b8be67b43b2bfb9f638 100644 (file)
@@ -155,6 +155,10 @@ bool SolveSpaceSolver_Solver::hasDegeneratedArcs() const
       const int aShift = anEntity.point[aPnt] - anEntity.h;
       int aPntInd = anEnt + aShift;
       int aStep = 1;
+      if (aPntInd < 0)
+        aPntInd = 0;
+      else if (aPntInd >= myEquationsSystem.entities)
+        aPntInd = myEquationsSystem.entities - 1;
       if (myEquationsSystem.entity[aPntInd].h > anEntity.point[aPnt])
         aStep = -1;
       for (; aPntInd >=0 && aPntInd < myEquationsSystem.entities; aPntInd += aStep)
index 681c96c57428634a2ee2d23270bdbf73e494bc32..7a185c8aff9dff14a95b3847438371cb9805842f 100644 (file)
@@ -278,7 +278,7 @@ void SolveSpaceSolver_Storage::addCoincidentPoints(
   // Search available coincidence
   CoincidentPointsMap::iterator aMasterFound = myCoincidentPoints.find(theMaster);
   CoincidentPointsMap::iterator aSlaveFound = myCoincidentPoints.find(theSlave);
-  if (aMasterFound == myCoincidentPoints.end() &&  aSlaveFound == myCoincidentPoints.end()) {
+  if (aMasterFound == myCoincidentPoints.end() || aSlaveFound == myCoincidentPoints.end()) {
     // try to find master and slave points in the lists of slaves of already existent coincidences
     CoincidentPointsMap::iterator anIt = myCoincidentPoints.begin();
     for (; anIt != myCoincidentPoints.end(); ++anIt) {