diff --git a/src/Approx/Approx_SameParameter.cxx b/src/Approx/Approx_SameParameter.cxx index 93ce3ac1bb..724d9a2401 100644 --- a/src/Approx/Approx_SameParameter.cxx +++ b/src/Approx/Approx_SameParameter.cxx @@ -481,8 +481,9 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance) new_par.Append(lcons); New_NCONTROL = new_par.Length() - 1; - //simple protection if New_NCONTROL > allocated elements in array - if (New_NCONTROL > aMaxArraySize) { + // Simple protection if New_NCONTROL > allocated elements in array but one + // aMaxArraySize - 1 index may be filled after projection. + if (New_NCONTROL > aMaxArraySize - 1) { mySameParameter = Standard_False; return; } diff --git a/src/GeomInt/GeomInt_LineConstructor.cxx b/src/GeomInt/GeomInt_LineConstructor.cxx index 04167298d3..bc32606753 100644 --- a/src/GeomInt/GeomInt_LineConstructor.cxx +++ b/src/GeomInt/GeomInt_LineConstructor.cxx @@ -788,7 +788,7 @@ void GeomInt_LineConstructor::TreatCircle(const Handle(IntPatch_Line)& aLine, aT=pVtx[1].Value()+aTwoPI; pVtx[aNbVtx-1].SetValue(aT); // - for(i=0; i<aNbVtx; ++i) { + for(i=0; i<aNbVtx - 1; ++i) { aT=pVtx[i+1].Value(); pVtx[i].SetValue(aT); }