]> OCCT Git - occt-copy.git/commitdiff
* 0031140: Draw command "cirtang" raises exception on the parallel curves
authorgka <gka@opencascade.com>
Thu, 7 Nov 2019 15:11:55 +0000 (18:11 +0300)
committergka <gka@opencascade.com>
Thu, 7 Nov 2019 16:49:16 +0000 (19:49 +0300)
To avoid exception for parallel curves because the number of solutions exceeds the size of the reserved array a check has been added that the number of solutions does not exceed the size of the reserved array.

src/Geom2dGcc/Geom2dGcc_Circ2d2TanRadGeo.cxx

index 2160dba82ab076b852e8fe7a2a5a90c01a2eba93..7f54f57d3e64cb8ba80d3a5a2a3dec91cdc946ab 100644 (file)
@@ -191,7 +191,7 @@ pararg2(1,aNbSolMAX)
         Geom2dInt_TheIntConicCurveOfGInter Intp(Line,D1,C2,D2,Tol,Tol);
         if (Intp.IsDone()) {
           if (!Intp.IsEmpty()) {
-            for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
+            for (Standard_Integer i = 1 ; i <= Intp.NbPoints() && NbrSol < cirsol.Length() ; i++) {
               NbrSol++;
               gp_Pnt2d Center(Intp.Point(i).Value());
               cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Center,dirx),Radius);
@@ -375,7 +375,7 @@ pararg2(1,aNbSolMAX)
         Intp.Perform(Circ,D1,C2,D2,Tol,Tol);
         if (Intp.IsDone()) {
           if (!Intp.IsEmpty()) {
-            for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
+            for (Standard_Integer i = 1 ; i <= Intp.NbPoints() && NbrSol < cirsol.Length() ; i++) {
               NbrSol++;
               gp_Pnt2d Center(Intp.Point(i).Value());
               cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Center,dirx),Radius);
@@ -507,7 +507,7 @@ pararg2(1,aNbSolMAX)
       Intp.Perform(Circ,D1,Cu2,D2,Tol,Tol);
       if (Intp.IsDone()) {
         if (!Intp.IsEmpty()) {
-          for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
+          for (Standard_Integer i = 1 ; i <= Intp.NbPoints() && NbrSol < cirsol.Length(); i++) {
             NbrSol++;
             gp_Pnt2d Center(Intp.Point(i).Value());
             cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Center,dirx),Radius);
@@ -853,7 +853,7 @@ pararg2(1,aNbSolMAX)
           if (!Intp.IsEmpty()) {
             const Standard_Real aSQApproxTol = Precision::Approximation() *
                                                 Precision::Approximation();
-            for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++)
+            for (Standard_Integer i = 1 ; i <= Intp.NbPoints() && NbrSol < cirsol.Length()  ; i++)
             {
               Standard_Real aU0 = Intp.Point(i).ParamOnFirst();
               Standard_Real aV0 = Intp.Point(i).ParamOnSecond();