]> OCCT Git - occt.git/commitdiff
0033743: Modeling Algorithm - fix crash with BRepFilletAPI_MakeChamfer CR33743
authorFlorian Foinant-Willig <flachyjoe@gmail.com>
Wed, 19 Jun 2024 19:18:57 +0000 (21:18 +0200)
committerFlorian Foinant-Willig <flachyjoe@gmail.com>
Wed, 19 Jun 2024 19:18:57 +0000 (21:18 +0200)
Handle a case where a newly created face does not contain a required
edge. Since the null edge was passed in, the algorithm would eventually
crash when trying to access its members.

src/ChFi3d/ChFi3d_Builder_2.cxx

index 2f4764c9f0a73d099f946f4d099339ad9c1d084e..1c17fd3365410dfe695aab0a58cb32d32c5f96dd 100644 (file)
@@ -1249,12 +1249,22 @@ ChFi3d_Builder::StartSol(const Handle(ChFiDS_Spine)&    Spine,
        TopoDS_Face newface = Fv;
        newface.Orientation(TopAbs_FORWARD);
        TopExp_Explorer ex;
+       Standard_Boolean found = 0;
        for(ex.Init(newface,TopAbs_EDGE); ex.More(); ex.Next()){
          if(ex.Current().IsSame(E)){
            newedge = TopoDS::Edge(ex.Current());
+           found = 1;
            break;
          }
        }
+       if (!found){
+         // E not in newface, the state is preserved and False is returned
+         HS->Initialize(F);
+         W = CP.ParameterOnArc();
+         pc = BRep_Tool::CurveOnSurface(E,F,Uf,Ul);
+         pons = pc->Value(W);
+         return Standard_False;
+       }
        HC->Initialize(newedge,Fv);
        pons = HC->Value(W);
        HCref->Initialize(E,F);