Modeling - BRepFilletAPI_MakeFillet Segfault with two curves and rim #532

Added null checks for TopoDS_Face in ChFi3d_Builder_2 and BRepAdaptor_Surface.
Added tests to check for crash.
This commit is contained in:
Dmitrii Kulikov
2025-05-15 19:35:52 +01:00
committed by GitHub
parent ebc3885799
commit a56d85bf15
3 changed files with 111 additions and 9 deletions

View File

@@ -1097,22 +1097,23 @@ static void ChFi3d_BuildPlane(TopOpeBRepDS_DataStructure& DStr,
const Standard_Boolean isfirst,
const Standard_Integer ons)
{
Handle(Geom2d_Curve) Hc;
TopoDS_Face F = TopoDS::Face(DStr.Shape(SD->Index(ons)));
Standard_Real u, v;
gp_Pnt P;
// gp_Vec V1,V2;
const TopoDS_Face F = TopoDS::Face(DStr.Shape(SD->Index(ons)));
if (F.IsNull())
{
return;
}
if (SD->Vertex(isfirst, ons).IsOnArc())
{
Hc = BRep_Tool::CurveOnSurface(SD->Vertex(isfirst, ons).Arc(), F, u, v);
Standard_Real u, v;
const Handle(Geom2d_Curve) Hc =
BRep_Tool::CurveOnSurface(SD->Vertex(isfirst, ons).Arc(), F, u, v);
Hc->Value(SD->Vertex(isfirst, ons).ParameterOnArc()).Coord(u, v);
BRepLProp_SLProps theProp(*HS, u, v, 1, 1.e-12);
if (theProp.IsNormalDefined())
{
P = theProp.Value();
Handle(Geom_Plane) Pln = new Geom_Plane(P, theProp.Normal());
TopoDS_Face NewF = BRepLib_MakeFace(Pln, Precision::Confusion());
const Handle(Geom_Plane) Pln = new Geom_Plane(theProp.Value(), theProp.Normal());
TopoDS_Face NewF = BRepLib_MakeFace(Pln, Precision::Confusion());
NewF.Orientation(F.Orientation());
pons.SetCoord(0., 0.);
HS->Initialize(NewF);