From: aml Date: Sat, 20 Feb 2016 08:54:44 +0000 (+0300) Subject: 0027194: Possible division by zero in IntPatch_WLineTool X-Git-Tag: V7_0_winwerth~45 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=871776ea38176a7658606f458a3be5c0326ad161;p=occt-copy.git 0027194: Possible division by zero in IntPatch_WLineTool Correct handling for division by zero is added. This prevents exception when FPE is enabled --- diff --git a/src/IntPatch/IntPatch_WLineTool.cxx b/src/IntPatch/IntPatch_WLineTool.cxx index e6080a3e8f..1b823b6ab9 100644 --- a/src/IntPatch/IntPatch_WLineTool.cxx +++ b/src/IntPatch/IntPatch_WLineTool.cxx @@ -379,9 +379,10 @@ static Handle(IntPatch_WLine) Standard_Real aStepOnS1 = aPntOnS1[0].SquareModulus() / aPntOnS1[1].SquareModulus(); Standard_Real aStepOnS2 = aPntOnS2[0].SquareModulus() / aPntOnS2[1].SquareModulus(); - Standard_Real aStepCoeff = Min(aStepOnS1, aStepOnS2) / Max(aStepOnS1, aStepOnS2); - - if (aStepCoeff > aLimitCoeff) + // Check very rare case when wline fluctuates nearly one point and some of them may be equal. + // Middle point will be deleted when such situation occurs. + // bugs moddata_2 bug469. + if (Min(aStepOnS1, aStepOnS2) >= aLimitCoeff * Max(aStepOnS1, aStepOnS2)) { // Set hash flag to "Delete" state. isDeleteState = Standard_True;