mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-24 13:50:49 +03:00
0031601: Modeling Algorithms - BRepOffset_Tool Segmentation Fault
Added protection against null pointer dereferencing. Modified BRepOffset_MakeOffset::MakeThickSolid method. Fixed the problem with negative volume values. Fixed several unit tests and added a new one.
This commit is contained in:
@@ -1292,11 +1292,10 @@ void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& Conte
|
||||
for ( ;exp2.More(); exp2.Next()) {
|
||||
LOE.Append(exp2.Current());
|
||||
}
|
||||
BRepOffset_Tool::TryProject(CF,OF1,LOE,LInt1,LInt2,mySide,myTol);
|
||||
//-------------------------------------------------------
|
||||
// If no trace try intersection.
|
||||
//-------------------------------------------------------
|
||||
if (LInt1.IsEmpty()) {
|
||||
if (!BRepOffset_Tool::TryProject(CF, OF1, LOE, LInt1, LInt2, mySide, myTol) || LInt1.IsEmpty()) {
|
||||
BRepOffset_Tool::Inter3D (CF,OF1,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
|
||||
}
|
||||
Store (CF,OF1,LInt1,LInt2);
|
||||
|
@@ -1175,12 +1175,16 @@ void BRepOffset_MakeOffset::MakeThickSolid(const Message_ProgressRange& theRange
|
||||
{
|
||||
NbOF++;
|
||||
}
|
||||
if (NbOF <= NbF)
|
||||
if (NbOF < NbF)
|
||||
{
|
||||
myDone = Standard_False;
|
||||
myError = BRepOffset_UnknownError;
|
||||
return;
|
||||
}
|
||||
if (NbOF == NbF)
|
||||
{
|
||||
myOffset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (myOffset > 0 ) myOffsetShape.Reverse();
|
||||
|
@@ -1881,6 +1881,10 @@ Standard_Boolean BRepOffset_Tool::TryProject
|
||||
if (C.IsNull()) {
|
||||
BRepLib::BuildCurve3d(CurE,BRep_Tool::Tolerance(CurE));
|
||||
C = BRep_Tool::Curve(CurE,L,f,l);
|
||||
if (C.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
C = new Geom_TrimmedCurve(C,f,l);
|
||||
if ( !L.IsIdentity()) C->Transform(L);
|
||||
@@ -3519,9 +3523,8 @@ void BRepOffset_Tool::ExtentFace (const TopoDS_Face& F,
|
||||
if (ToBuild.IsBound(E)) {
|
||||
TopTools_ListOfShape LOE;
|
||||
LOE.Append(E);
|
||||
BRepOffset_Tool::TryProject (TopoDS::Face(ToBuild(E)),
|
||||
EF,LOE,LInt2,LInt1,Side,TolConf);
|
||||
if (!LInt1.IsEmpty())
|
||||
if (BRepOffset_Tool::TryProject(TopoDS::Face(ToBuild(E)), EF, LOE, LInt2, LInt1, Side, TolConf)
|
||||
&& !LInt1.IsEmpty())
|
||||
ToBuild.UnBind(E);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user