mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-06-05 11:24:17 +03:00
0033567: Modeling Data - GeomLib_IsPlanarSurface raises exception SIGFPE Arithmetic Exception in Release mode
Add protection against zero-division
This commit is contained in:
parent
beb4a7cfab
commit
f11043a8e8
@ -76,13 +76,18 @@ static Standard_Boolean Controle(const TColgp_Array1OfPnt& Poles,
|
||||
Standard_Real umin, umax, vmin, vmax;
|
||||
S->Bounds(umin, umax, vmin, vmax);
|
||||
S->D1( (umin+umax)/2, (vmin+vmax)/2, P, DU, DV);
|
||||
|
||||
if (DU.SquareMagnitude() > gp::Resolution() &&
|
||||
DV.SquareMagnitude() > gp::Resolution())
|
||||
{
|
||||
// On prend DX le plus proche possible de DU
|
||||
gp_Dir du(DU);
|
||||
Standard_Real Angle1 = du.Angle(DX);
|
||||
Standard_Real Angle2 = du.Angle(DY);
|
||||
if (Angle1 > M_PI/2) Angle1 = M_PI-Angle1;
|
||||
if (Angle2 > M_PI/2) Angle2 = M_PI-Angle2;
|
||||
if (Angle2 < Angle1) {
|
||||
if (Angle2 < Angle1)
|
||||
{
|
||||
du = DY; DY = DX; DX = du;
|
||||
}
|
||||
if (DX.Angle(DU) > M_PI/2) DX.Reverse();
|
||||
@ -94,6 +99,7 @@ static Standard_Boolean Controle(const TColgp_Array1OfPnt& Poles,
|
||||
IsPlan = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
return IsPlan;
|
||||
}
|
||||
|
||||
|
11
tests/bugs/moddata_3/bug33567
Normal file
11
tests/bugs/moddata_3/bug33567
Normal file
@ -0,0 +1,11 @@
|
||||
puts "==========================================================="
|
||||
puts "0033567: Modeling Data - GeomLib_IsPlanarSurface raises SIGFPE in Release mode"
|
||||
puts "==========================================================="
|
||||
|
||||
puts "REQUIRED All: Conversion failed"
|
||||
|
||||
pload MODELING
|
||||
|
||||
restore [locate_data_file bug33567.brep] a
|
||||
mksurface s a
|
||||
tocanon r s 0.0005
|
Loading…
x
Reference in New Issue
Block a user