oce icon indicating copy to clipboard operation
oce copied to clipboard

StepToTopoDS_TranslateEdgeLoop::Init() may crash with certain STEP files

Open mikedstrong opened this issue 9 years ago • 1 comments

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.

crash.zip

mikedstrong avatar Feb 11 '16 15:02 mikedstrong

Reported to OCCT: http://tracker.dev.opencascade.org/view.php?id=27330

ghost avatar Mar 31 '16 17:03 ghost