From: vro Date: Thu, 22 Aug 2013 08:59:16 +0000 (+0400) Subject: 0024083: BRepCheck_Wire crashes processing a wire consisting of many edges X-Git-Tag: V6_7_0_beta~163 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=22774b6295ebfe7780fd6df095a868f1503be990 0024083: BRepCheck_Wire crashes processing a wire consisting of many edges A check on 0 is added. A recursive method Propagate() is replaced by a non-recursive implementation. Adding test case for issue CR24083 --- diff --git a/src/BRepCheck/BRepCheck_Wire.cxx b/src/BRepCheck/BRepCheck_Wire.cxx index 0fb2df20a8..fb576ed726 100755 --- a/src/BRepCheck/BRepCheck_Wire.cxx +++ b/src/BRepCheck/BRepCheck_Wire.cxx @@ -1529,40 +1529,51 @@ Standard_Boolean BRepCheck_Wire::GeometricControls() const return myGctrl; } - //======================================================================= //function : Propagate //purpose : fill with edges connected to through vertices // contained in //======================================================================= static void Propagate(const TopTools_IndexedDataMapOfShapeListOfShape& mapVE, - const TopoDS_Shape& edg, - TopTools_MapOfShape& mapE) + const TopoDS_Shape& edg, + TopTools_MapOfShape& mapE) { - if (mapE.Contains(edg)) { - return; - } - mapE.Add(edg); // attention, if oriented == Standard_True, edge should - // be FORWARD or REVERSED. It is not checked. - // ============= - // attention, if oriented == Standard_True, must - // be FORWARD or REVERSED. That is not checked. - - TopExp_Explorer ex; - for (ex.Init(edg,TopAbs_VERTEX); ex.More(); ex.Next()) { - const TopoDS_Vertex& vtx = TopoDS::Vertex(ex.Current()); - // debug on vertex - Standard_Integer indv = mapVE.FindIndex(vtx); - if (indv != 0) { - for (TopTools_ListIteratorOfListOfShape itl(mapVE(indv)); itl.More(); itl.Next()) { - if (!itl.Value().IsSame(edg) && - !mapE.Contains(itl.Value())) { - Propagate(mapVE,itl.Value(),mapE); - } + TopTools_ListOfShape currentEdges; + currentEdges.Append(edg); + + do + { + TopTools_ListOfShape nextEdges; + TopTools_ListIteratorOfListOfShape itrc(currentEdges); + for (; itrc.More(); itrc.Next()) + { + const TopoDS_Shape& Edge = itrc.Value(); + mapE.Add(Edge); + + TopExp_Explorer ex(Edge, TopAbs_VERTEX); + for (; ex.More(); ex.Next()) + { + const TopoDS_Vertex& vtx = TopoDS::Vertex(ex.Current()); + Standard_Integer indv = mapVE.FindIndex(vtx); + if (indv != 0) + { + const TopTools_ListOfShape& edges = mapVE(indv); + + TopTools_ListIteratorOfListOfShape itl(edges); + for (; itl.More(); itl.Next()) + { + const TopoDS_Shape& E = itl.Value(); + if (!Edge.IsSame(E) && !mapE.Contains(E)) + nextEdges.Append(E); + } + } } } + currentEdges = nextEdges; } + while (!currentEdges.IsEmpty()); } + //======================================================================= //function : GetOrientation //purpose : diff --git a/tests/bugs/modalg_5/bug24083 b/tests/bugs/modalg_5/bug24083 new file mode 100755 index 0000000000..9517834573 --- /dev/null +++ b/tests/bugs/modalg_5/bug24083 @@ -0,0 +1,13 @@ +puts "================" +puts "CR24083" +puts "================" +puts "" +####################################################################### +# BRepCheck_Wire crashes processing a wire consisting of many edges +####################################################################### + +restore [locate_data_file bug24083_polyline.brep] result + +set length 141421 + +set 2dviewer 1