]> OCCT Git - occt-copy.git/commitdiff
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 93ce3ac1bba8d9a8ec4fe03ad939089b69e6fc7e..724d9a2401f035c7475f30891319f3cc6524d019 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 04167298d31fe141e16c7c0d7cd97f87450fcafb..bc32606753c2c4bdac072bafe22174c16cc3eb07 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);
       }