From d1d68ce7144b60d84ee803d12d543a38ce990260 Mon Sep 17 00:00:00 2001 From: aml Date: Mon, 10 Oct 2016 15:08:36 +0300 Subject: [PATCH] 0027946: Out of range item access in offset algorithm Out of range access has been eliminated. --- src/BRepOffset/BRepOffset_Inter2d.cxx | 2 ++ tests/bugs/modalg_6/bug27907 | 17 +++++++++++++++++ tests/bugs/modalg_6/bug27907_1 | 17 +++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 tests/bugs/modalg_6/bug27907 create mode 100644 tests/bugs/modalg_6/bug27907_1 diff --git a/src/BRepOffset/BRepOffset_Inter2d.cxx b/src/BRepOffset/BRepOffset_Inter2d.cxx index c559e96d2f..016e09f3af 100644 --- a/src/BRepOffset/BRepOffset_Inter2d.cxx +++ b/src/BRepOffset/BRepOffset_Inter2d.cxx @@ -1452,6 +1452,8 @@ void BRepOffset_Inter2d::ConnexIntByInt TopoDS_Shape aLocalWire = W .Oriented(TopAbs_FORWARD); TopoDS_Shape aLocalFace = FI.Oriented(TopAbs_FORWARD); wexp.Init(TopoDS::Wire(aLocalWire),TopoDS::Face(aLocalFace)); + if (!wexp.More()) + continue; // Protection from case when explorer does not contain edges. // wexp.Init(TopoDS::Wire(W .Oriented(TopAbs_FORWARD)), // TopoDS::Face(FI.Oriented(TopAbs_FORWARD))); CurE = FirstE = wexp.Current(); diff --git a/tests/bugs/modalg_6/bug27907 b/tests/bugs/modalg_6/bug27907 new file mode 100644 index 0000000000..e3f95b1b7b --- /dev/null +++ b/tests/bugs/modalg_6/bug27907 @@ -0,0 +1,17 @@ +puts "========" +puts "OCC27907" +puts "========" +puts "" +################################################# +# Exception during offset computation +################################################# + +restore [locate_data_file bug27907.brep] s + +# Perform test. +offsetparameter 1e-7 p i +offsetload s 10 +offsetperform result + +# Check result validity. +checkshape result diff --git a/tests/bugs/modalg_6/bug27907_1 b/tests/bugs/modalg_6/bug27907_1 new file mode 100644 index 0000000000..23f1855fd9 --- /dev/null +++ b/tests/bugs/modalg_6/bug27907_1 @@ -0,0 +1,17 @@ +puts "========" +puts "OCC27907" +puts "========" +puts "" +################################################# +# Exception during offset computation +################################################# + +restore [locate_data_file bug27907_1.brep] s + +# Perform test. +offsetparameter 1e-7 p i +offsetload s 10 +offsetperform result + +# Check result validity. +checkshape result \ No newline at end of file