Corrupt STP file causes crash

Hi all,

When I try to read a corrupted step file I observe a crash in the “TransferRoots()” method of the STEPControl_Reader. The corrupted step file is read without errors but causes a crash afterwards. The crash happens because a nullptr is accessed in this method:

Standard_Integer StepGeom_Direction::NbDirectionRatios () const
    return directionRatios->Length();

Wrapping in a try-catch-block does not help. Has anybody an idea on how we could prevent this crash?

Please note: The STP file has been broken on purpose to test our application for robustness against corrupted input.

Kirill Gavrilov's picture

1. It would be useful reporting a bug to OCCT (and even better - propose a patch). Even if file is broken, OCCT code should perform proper NULL checks to report/ignore errors.
2. Check documentation of OSD::SetSignal() if you would like to intercept such issues and prevent application from termination.

Tilo Pfliegner's picture

Thanks, Kirill.

It seems I cannot log in to Mantis BT using my OpenCascade sign-on credentials, so how do I report a bug? Unfortunately the FAQ | Open CASCADE Technology page seems broken, I can only see the questions.