From: razmyslovich Date: Wed, 14 May 2014 10:28:15 +0000 (+0200) Subject: 0024919: ShapeFix can crash time-to-time due to inproper interator handling inside... X-Git-Tag: V6_8_0_beta~322 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=3f5bebe804e15e7d8c2ab7191f1d97dc4e82740c;p=occt.git 0024919: ShapeFix can crash time-to-time due to inproper interator handling inside of Approx_SameParameter::Build function Check inter variable to be inside of the desired range --- diff --git a/src/Approx/Approx_SameParameter.cxx b/src/Approx/Approx_SameParameter.cxx index 3fc41f3f17..3589ae0fc8 100644 --- a/src/Approx/Approx_SameParameter.cxx +++ b/src/Approx/Approx_SameParameter.cxx @@ -451,10 +451,10 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance) ii =1; new_par.Append(fcons); - while(Param_de_decoupeC1(inter) <= fcons + deltamin) inter++; - while(Param_de_decoupeC1(NbInt) >= lcons - deltamin) NbInt--; + while(inter <= NbInt && Param_de_decoupeC1(inter) <= fcons + deltamin) inter++; + while(NbInt > 0 && Param_de_decoupeC1(NbInt) >= lcons - deltamin) NbInt--; - while(inter <= NbInt || ii < NCONTROL) { + while(inter <= NbInt || (ii < NCONTROL && inter <= Param_de_decoupeC1.Length()) ) { if(Param_de_decoupeC1(inter) < pcons[ii]) { new_par.Append(Param_de_decoupeC1(inter)); if((pcons[ii] - Param_de_decoupeC1(inter)) <= deltamin) {