From b26415fbb196446f22f8bee152e72812fa4ca256 Mon Sep 17 00:00:00 2001 From: nbv Date: Thu, 4 Jun 2015 14:01:53 +0300 Subject: [PATCH] 0026281: BRepCheck_Edge::Tolerance() raises exception on the given shapes The reason of the exception has been eliminated Test-cases for issue #26281 --- src/BSplCLib/BSplCLib.cxx | 4 ++++ src/BSplSLib/BSplSLib.cxx | 3 +++ tests/bugs/modalg_6/bug26281_1 | 10 ++++++++++ tests/bugs/modalg_6/bug26281_2 | 10 ++++++++++ 4 files changed, 27 insertions(+) create mode 100644 tests/bugs/modalg_6/bug26281_1 create mode 100644 tests/bugs/modalg_6/bug26281_2 diff --git a/src/BSplCLib/BSplCLib.cxx b/src/BSplCLib/BSplCLib.cxx index c87c5b76c8..e8cb3c573e 100644 --- a/src/BSplCLib/BSplCLib.cxx +++ b/src/BSplCLib/BSplCLib.cxx @@ -275,6 +275,10 @@ void BSplCLib::LocateParameter while (val <= Eps) { KnotIndex++; + + if(KnotIndex >= Knots.Upper()) + break; + K1 = K2; K2 = knots[KnotIndex + 1]; val = K2 - K1; diff --git a/src/BSplSLib/BSplSLib.cxx b/src/BSplSLib/BSplSLib.cxx index 813d6ae4c4..46d43bc3cd 100644 --- a/src/BSplSLib/BSplSLib.cxx +++ b/src/BSplSLib/BSplSLib.cxx @@ -570,6 +570,9 @@ static Standard_Boolean PrepareEval (const Standard_Real U, if(ip < PLowerRow) ip = PUpperRow; + if(ip > PUpperRow) + ip = PLowerRow; + for (j = 0; j <= d2; j++) { const gp_Pnt& P = Poles.Value(ip,jp); diff --git a/tests/bugs/modalg_6/bug26281_1 b/tests/bugs/modalg_6/bug26281_1 new file mode 100644 index 0000000000..5e9a2ecc07 --- /dev/null +++ b/tests/bugs/modalg_6/bug26281_1 @@ -0,0 +1,10 @@ +puts "========" +puts "OCC26281" +puts "========" +puts "" +#################################################################### +# BRepCheck_Edge::Tolerance() raises exception on the given shapes +#################################################################### + +restore [locate_data_file OCC26281_a_6055.brep] a +computetolerance a diff --git a/tests/bugs/modalg_6/bug26281_2 b/tests/bugs/modalg_6/bug26281_2 new file mode 100644 index 0000000000..0eab2240eb --- /dev/null +++ b/tests/bugs/modalg_6/bug26281_2 @@ -0,0 +1,10 @@ +puts "========" +puts "OCC26281" +puts "========" +puts "" +#################################################################### +# BRepCheck_Edge::Tolerance() raises exception on the given shapes +#################################################################### + +restore [locate_data_file OCC26281_a_6213.brep] a +computetolerance a