mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0025559: SIGSEGV in TKMath when computing max tolerance of curve on surface
Fixed possible being outside the boundaries. Changed check math_Recipes to work with NaN, Inf, Ind. Test case for issue CR25559
This commit is contained in:
parent
d315303da2
commit
b49eaa701f
@ -344,6 +344,8 @@ class BOPTools_CheckCurveOnSurface :
|
|||||||
Standard_Real& theFVal) {
|
Standard_Real& theFVal) {
|
||||||
try {
|
try {
|
||||||
const Standard_Real aPar = theX(1);
|
const Standard_Real aPar = theX(1);
|
||||||
|
if (!CheckParameter(aPar))
|
||||||
|
return Standard_False;
|
||||||
gp_Pnt aP1, aP2;
|
gp_Pnt aP1, aP2;
|
||||||
gp_Pnt2d aP2d;
|
gp_Pnt2d aP2d;
|
||||||
my3DCurve->D0(aPar, aP1);
|
my3DCurve->D0(aPar, aP1);
|
||||||
@ -367,7 +369,8 @@ class BOPTools_CheckCurveOnSurface :
|
|||||||
math_Vector& theGrad) {
|
math_Vector& theGrad) {
|
||||||
try {
|
try {
|
||||||
const Standard_Real aPar = theX(1);
|
const Standard_Real aPar = theX(1);
|
||||||
|
if (!CheckParameter(aPar))
|
||||||
|
return Standard_False;
|
||||||
gp_Pnt aP1, aP2;
|
gp_Pnt aP1, aP2;
|
||||||
gp_Vec aDC3D, aDSU, aDSV;
|
gp_Vec aDC3D, aDSU, aDSV;
|
||||||
gp_Pnt2d aP2d;
|
gp_Pnt2d aP2d;
|
||||||
@ -417,6 +420,19 @@ class BOPTools_CheckCurveOnSurface :
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Standard_Boolean CheckParameter(const Standard_Real theParam)
|
||||||
|
{
|
||||||
|
if (theParam < my3DCurve->FirstParameter() ||
|
||||||
|
theParam > my3DCurve->LastParameter() ||
|
||||||
|
theParam < my2DCurve->FirstParameter() ||
|
||||||
|
theParam > my2DCurve->LastParameter() )
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
Handle(Geom_Curve) my3DCurve;
|
Handle(Geom_Curve) my3DCurve;
|
||||||
Handle(Geom2d_Curve) my2DCurve;
|
Handle(Geom2d_Curve) my2DCurve;
|
||||||
Handle(Geom_Surface) mySurf;
|
Handle(Geom_Surface) mySurf;
|
||||||
|
@ -205,10 +205,13 @@ Standard_Integer LU_Decompose(math_Matrix& a,
|
|||||||
for(k = 1; k < j; k++)
|
for(k = 1; k < j; k++)
|
||||||
sum -= a(i,k) * a(k,j);
|
sum -= a(i,k) * a(k,j);
|
||||||
a(i,j) = sum;
|
a(i,j) = sum;
|
||||||
if((dum = vv(i) * fabs(sum)) >= big) {
|
// Note that comparison is made so as to have imax updated even if argument is NAN, Inf or IND, see #25559
|
||||||
big = dum;
|
if((dum = vv(i) * fabs(sum)) < big)
|
||||||
imax = i;
|
{
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
big = dum;
|
||||||
|
imax = i;
|
||||||
}
|
}
|
||||||
if(j != imax) {
|
if(j != imax) {
|
||||||
for(k = 1; k <= n; k++) {
|
for(k = 1; k <= n; k++) {
|
||||||
|
11
tests/bugs/modalg_5/bug25559
Executable file
11
tests/bugs/modalg_5/bug25559
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC25559"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
######################################################
|
||||||
|
# SIGSEGV in TKMath when computing max tolerance of curve on surface
|
||||||
|
######################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug25559_f.brep] f
|
||||||
|
|
||||||
|
checkcurveonsurf f
|
Loading…
x
Reference in New Issue
Block a user