1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-06-30 12:14:08 +03:00

0025559: SIGSEGV in TKMath when computing max tolerance of curve on surface

Fixed possible being outside the boundaries.
This commit is contained in:
aml 2014-12-08 11:51:25 +03:00 committed by vsr
parent 5c4a9ab709
commit b8265cb716

View File

@ -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;