0025770: Possible "invalid memory access"
authoraml <aml@opencascade.com>
Fri, 30 Jan 2015 10:13:06 +0000 (13:13 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 5 Feb 2015 11:56:43 +0000 (14:56 +0300)
Memory problems fixed.

src/Approx/Approx_SameParameter.cxx
src/GeomInt/GeomInt_LineConstructor.cxx

index 93ce3ac..724d9a2 100644 (file)
@@ -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;
     }
index 0416729..bc32606 100644 (file)
@@ -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);
       }