HLRBRep_Algo.Update() causes crashes with some models.

Hello everybody,

We have recently discovered issue with HLRBRep_Algo.Update() method. With one particular model the program crashes (OpenCascade version v7.3.0). The call stack showed that the problem was in TKMath.dll

After some debugging we have come up with a solution for OpenCascade v7.4.0:

In src\math\math_FunctionAllRoots.cxx change line 117 from:

  Standard_NumericError_Raise_if((!Res1.IsDone())   ||
			  (Res1.IsAllNull()) ||
			  (Res1.NbSolutions()==0), " ");
  DebNul=Res1.Value(Res1.NbSolutions());
  Indd = Res1.StateNumber(Res1.NbSolutions());

to this:

Standard_NumericError_Raise_if((!Res1.IsDone()) ||
	  (Res1.IsAllNull()), " ");

if (Res1.NbSolutions() > 0) {
	DebNul = Res1.Value(Res1.NbSolutions());
	Indd = Res1.StateNumber(Res1.NbSolutions());
}

 

So if anybody faces this issue, this might be helpful. Also if OpenCascade team can test and integrate this workaround into OpenCascade that be very helpful.

Thanks for your attention.
Have a great day,

Jaroslav