oce
oce copied to clipboard
StepToTopoDS_TranslateEdgeLoop::Init() may crash with certain STEP files
I experienced a crash in StepToTopoDS_TranslateEdgeLoop::Init() with certain STEP files containing unusual geometry (mine was created using a CAD model containing a cosmetic feature). The crash occurred at line 330:
StepToTopoDS_TranslateVertex myTranVertex1(Vstart, aTool, NMTool);
It occurred because Vstart was undefined, and this was because curve C was null. To fix this, I added a else case to the existing test for a null curve and returned an error, instead of continuing. My new code looks like this (with commented-out code removed):
if (!C.IsNull()){
if (C->IsKind(STANDARD_TYPE(StepGeom_SurfaceCurve))) {
Handle(StepGeom_SurfaceCurve) Sc = Handle(StepGeom_SurfaceCurve)::DownCast(C);
C = Sc->Curve3d();
}
}
else {
TP->AddWarning(EL,"Null Curve.");
done = Standard_False;
return;
}
Please find attached a simple STEP file that demonstrates the crash.
Reported to OCCT: http://tracker.dev.opencascade.org/view.php?id=27330