DiscussionsIssue archiveOCCT:Data Exchange

Archived issue #0032314

Data Exchange - Reading corrupted STEP files crashes

CommunityOCCT:Data Exchangeclosed6 public notes

Search issues

Description

When importing a (deliberately) corrupted STEP file (see attached file), STEPControl_Reader crashes in TransferRoots().

Steps to reproduce

pload XDE OCAF
dsetsignal unset
testreadstep Attachment 1 (STP) s
ReadStep D Attachment 1 (STP)


The following lines of code produce this error:
    STEPControl_Reader reader;
    IFSelect_ReturnStatus result =  reader.ReadFile("Attachment 1 (STP)"); // returns "Done" with a few errors
    reader.TransferRoots(); // crashes


The root cause seems to be dereferencing a nullptr (directionRatios) in this method:
Standard_Integer StepGeom_Direction::NbDirectionRatios () const
{
    return directionRatios->Length();
}


However, I am not sure, what the correct solution would look like. Probably it would be best to return IFSelect_RetError from ReadFile(...) in these cases.

Public activity

6 archived notes

Participants are labeled by their role within this record.

01Commenter 2
Branch [archived branch] has been created by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Wed Apr 28 11:53:40 2021 +0300

    0032314: Data Exchange - Reading corrupted STEP files crashes
    
    RWAxis2Placement3d:
     fixed problem with reading parameters ( if sub-entity invalid, set has-parameter to false )
02Commenter 2
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
03Commenter 3
04Commenter 4
No remarks.

Dear Commenter 1,
please integrate
OCCT - CR32314
Products - NOT
05Commenter 1
Combination -
OCCT branch : [archived branch]
Products branch : [archived branch]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 17839.600000000362 / 17844.450000000477 [-0.03%]
Products
Total CPU difference: 11562.480000000109 / 11558.800000000136 [+0.03%]
Windows-64-VC14:
OCCT
Total CPU difference: 19303.28125 / 19431.828125 [-0.66%]
Products
Total CPU difference: 12894.515625 / 12871.203125 [+0.18%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
06Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]