From 871776ea38176a7658606f458a3be5c0326ad161 Mon Sep 17 00:00:00 2001 From: aml Date: Sat, 20 Feb 2016 11:54:44 +0300 Subject: [PATCH] 0027194: Possible division by zero in IntPatch_WLineTool Correct handling for division by zero is added. This prevents exception when FPE is enabled --- src/IntPatch/IntPatch_WLineTool.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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; -- 2.39.5