From 77676f1b6d5f193b3d3312b58623f76f72fdf60f Mon Sep 17 00:00:00 2001 From: gka Date: Thu, 7 Nov 2019 18:11:55 +0300 Subject: [PATCH] * 0031140: Draw command "cirtang" raises exception on the parallel curves 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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Geom2dGcc/Geom2dGcc_Circ2d2TanRadGeo.cxx b/src/Geom2dGcc/Geom2dGcc_Circ2d2TanRadGeo.cxx index 2160dba82a..7f54f57d3e 100644 --- a/src/Geom2dGcc/Geom2dGcc_Circ2d2TanRadGeo.cxx +++ b/src/Geom2dGcc/Geom2dGcc_Circ2d2TanRadGeo.cxx @@ -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();