From 5833894f2ee694a6d5961a471cabc67b5837b304 Mon Sep 17 00:00:00 2001 From: gka Date: Thu, 7 Nov 2019 18:11:14 +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 fd5167de6d..c3e9a3570b 100644 --- a/src/Geom2dGcc/Geom2dGcc_Circ2d2TanRadGeo.cxx +++ b/src/Geom2dGcc/Geom2dGcc_Circ2d2TanRadGeo.cxx @@ -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(); -- 2.39.5