]> 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:14 +0000 (18:11 +0300)
committergka <gka@opencascade.com>
Thu, 7 Nov 2019 16:46:23 +0000 (19:46 +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 fd5167de6d1901f4d4f1af1b646bb925d7384809..c3e9a3570b982e16705d1a276eb354b3bd5242ee 100644 (file)
@@ -189,7 +189,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);
@@ -373,7 +373,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);
@@ -505,7 +505,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);
@@ -857,7 +857,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();