MantisBT - Community
View Issue Details
0029979Community[OCCT] OCCT:Data Exchangepublic2018-07-23 18:112019-03-20 08:31
borm 
gka 
normalcrash 
assignedopen 
WindowsVC++ 201510
[OCCT] 7.2.0 
[OCCT] 7.5.0 
0029979: Data Exchange - Crash by reading STEP file
Hi, the OCCT crashes by reading the STEP file:

The crash callstack is:
>	TKSTEPBase.dll!StepShape_EdgeCurve::EdgeGeometry() Line 47	C++
     TKSTEP.dll!StepToTopoDS_TranslateEdgeLoop::Init(const opencascade::handle<StepShape_FaceBound> 
& FaceBound, const TopoDS_Face & Face, const opencascade::handle<Geom_Surface> & GeomSurf, 
const opencascade::handle<StepGeom_Surface> & StepSurf, const bool sameSense, StepToTopoDS_Tool 
& aTool, StepToTopoDS_NMTool & NMTool) Line 296	C++
     TKSTEP.dll!StepToTopoDS_TranslateFace::Init(const opencascade::handle<StepShape_FaceSurface> 
& FS, StepToTopoDS_Tool & aTool, StepToTopoDS_NMTool & NMTool) Line 330	C++
     TKSTEP.dll!StepToTopoDS_TranslateShell::Init(const opencascade::handle<StepShape_ConnectedFaceSet> 
& CFS, StepToTopoDS_Tool & aTool, StepToTopoDS_NMTool & NMTool) Line 93	C++
     TKSTEP.dll!StepToTopoDS_Builder::Init(const opencascade::handle<StepShape_ManifoldSolidBrep> 
& aManifoldSolid, const opencascade::handle<Transfer_TransientProcess> & TP) Line 210	C++
     
TKSTEP.dll!STEPControl_ActorRead::TransferEntity(const opencascade::handle<StepGeom_GeometricRepresentationItem> 
& start, const opencascade::handle<Transfer_TransientProcess> & TP, const bool isManifold) 
Line 1229	C++
     TKSTEP.dll!STEPControl_ActorRead::TransferShape(const opencascade::handle<Standard_Transient> 
& start, const opencascade::handle<Transfer_TransientProcess> & TP, const bool isManifold) 
Line 1499	C++
     TKSTEP.dll!STEPControl_ActorRead::TransferEntity(const opencascade::handle<StepShape_ShapeRepresentation> 
& sr, const opencascade::handle<Transfer_TransientProcess> & TP, bool & isBound) Line 
817	C++
     TKSTEP.dll!STEPControl_ActorRead::TransferEntity(const opencascade::handle<StepRepr_ShapeRepresentationRelationship> 
& und, const opencascade::handle<Transfer_TransientProcess> & TP, const int nbrep) Line 
1020	C++
     TKSTEP.dll!STEPControl_ActorRead::TransferEntity(const opencascade::handle<StepBasic_ProductDefinition> 
& PD, const opencascade::handle<Transfer_TransientProcess> & TP) Line 628	C++
     TKSTEP.dll!STEPControl_ActorRead::TransferEntity(const opencascade::handle<StepRepr_NextAssemblyUsageOccurrence> 
& NAUO, const opencascade::handle<Transfer_TransientProcess> & TP) Line 717	C++
     TKSTEP.dll!STEPControl_ActorRead::TransferEntity(const opencascade::handle<StepBasic_ProductDefinition> 
& PD, const opencascade::handle<Transfer_TransientProcess> & TP) Line 549	C++
     TKSTEP.dll!STEPControl_ActorRead::TransferShape(const opencascade::handle<Standard_Transient> 
& start, const opencascade::handle<Transfer_TransientProcess> & TP, const bool isManifold) 
Line 1460	C++
     TKSTEP.dll!STEPControl_ActorRead::Transfer(const opencascade::handle<Standard_Transient> & 
start, const opencascade::handle<Transfer_TransientProcess> & TP) Line 300	C++
     TKXSBase.dll!Transfer_ActorOfTransientProcess::Transferring(const opencascade::handle<Standard_Transient> 
& ent, const opencascade::handle<Transfer_ProcessForTransient> & TP) Line 40	C++
     TKXSBase.dll!Transfer_ProcessForTransient::TransferProduct(const opencascade::handle<Standard_Transient> 
& start) Line 1160	C++
     TKXSBase.dll!Transfer_ProcessForTransient::Transferring(const opencascade::handle<Standard_Transient> 
& start) Line 1067	C++
     TKXSBase.dll!Transfer_ProcessForTransient::Transfer(const opencascade::handle<Standard_Transient> 
& start) Line 1189	C++
     TKXSBase.dll!Transfer_TransferOutput::Transfer(const opencascade::handle<Standard_Transient> 
& obj) Line 79	C++
     TKXSBase.dll!XSControl_TransferReader::TransferOne(const opencascade::handle<Standard_Transient> 
& ent, const bool rec) Line 816	C++
     TKXSBase.dll!XSControl_Reader::TransferEntity(const opencascade::handle<Standard_Transient> 
& start) Line 242	C++
     TKXSBase.dll!XSControl_Reader::TransferOneRoot(const int num) Line 216	C++
     TKXDESTEP.dll!STEPCAFControl_Reader::Transfer(STEPControl_Reader & reader, const int nroot, 
opencascade::handle<TDocStd_Document> & doc, NCollection_Sequence<TDF_Label> & Lseq, 
const bool asOne) Line 522	C++
     TKXDESTEP.dll!STEPCAFControl_Reader::Transfer(opencascade::handle<TDocStd_Document> & 
doc) Line 404	C++
     TKXDESTEP.dll!STEPCAFControl_Reader::Perform(const char * const filename, opencascade::handle<TDocStd_Document> 
& doc) Line 418	C++
Test case bugs/step/bug26451.

The following code produces a crash:

Handle(TDocStd_Document) pOcctDoc;
Handle(XCAFApp_Application) pOcctApp = XCAFApp_Application::GetApplication();
pOcctApp->NewDocument("MDTV-XCAF", pOcctDoc);

STEPCAFControl_Reader stepReader;
stepReader.SetColorMode(Standard_True);
stepReader.SetNameMode(Standard_True);
const auto result = stepReader.Perform(fileName, pOcctDoc);
No tags attached.
related to 0030541new abv Open CASCADE Draw Harness - impossible disabling signals 
7z Firetherm_12.7z (9,659,229) 2019-03-06 11:55
https://tracker.dev.opencascade.org/
Issue History
2018-07-23 18:11bormNew Issue
2018-07-23 18:11bormAssigned To => gka
2019-03-03 00:04kgvNote Added: 0082542
2019-03-03 00:04kgvAssigned Togka => borm
2019-03-03 00:04kgvStatusnew => feedback
2019-03-05 18:59bormNote Added: 0082701
2019-03-05 23:05kgvNote Added: 0082706
2019-03-05 23:06kgvNote Edited: 0082706bug_revision_view_page.php?bugnote_id=82706#r20791
2019-03-06 10:25kgvResolutionopen => unable to reproduce
2019-03-06 11:36bormNote Added: 0082723
2019-03-06 11:45kgvNote Added: 0082724
2019-03-06 11:45kgvAssigned Toborm => gka
2019-03-06 11:45kgvStatusfeedback => assigned
2019-03-06 11:45kgvResolutionunable to reproduce => open
2019-03-06 11:45kgvTarget Version => 7.5.0
2019-03-06 11:52kgvRelationship addedrelated to 0030541
2019-03-06 11:53kgvSummaryCrash by reading STEP file => Data Exchange - Crash by reading STEP file
2019-03-06 11:55kgvFile Added: Firetherm_12.7z
2019-03-06 11:56kgvDescription Updatedbug_revision_view_page.php?rev_id=20797#r20797
2019-03-06 11:56kgvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=20799#r20799
2019-03-06 11:56bormNote Added: 0082725
2019-03-06 12:05kgvRelationship addedrelated to 0030533
2019-03-20 08:31kgvNote Added: 0083122
2019-03-20 08:31kgvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=20877#r20877

Notes
(0082542)
kgv   
2019-03-03 00:04   
Referred file is inaccessible.
(0082701)
borm   
2019-03-05 18:59   
Hi, the link works again. Please download the file as the link expires on 31.3.2019 again. Thanks.
(0082706)
kgv   
2019-03-05 23:05   
(edited on: 2019-03-05 23:06)
I'm unable reproducing the crash with the following script:
pload ALL
ReadStep D "Firetherm 12.STEP"
XShow D
vfit



Are there any extra input requisites?
Or maybe wrong OCCT version is specified?

(0082723)
borm   
2019-03-06 11:36   
I'm not aware of the script code so I can comment just on the C++ code. The STEPCAFControl_Reader has to be used and the color and name mode must be set to true to reproduce the crash. I can still reproduce it with the OCCT 7.2.0 and I get the same crash callstack.
(0082724)
kgv   
2019-03-06 11:45   
OK, your application doesn't setup signals.

void StepToTopoDS_TranslateEdgeLoop::Init(
...
  for (j=1; j<=NbEdge; j++ ) {
    OrEdge1  = EL->EdgeListValue(j);
    StepEdge = OrEdge1->EdgeElement();
//    if(j>1 && StepEdge == StepEdge1) theSame++; //gka 15.12.98
    StepEdge1 = StepEdge;                         //
    Handle(StepShape_EdgeCurve) EC = Handle(StepShape_EdgeCurve)::DownCast(StepEdge);
    Handle(StepGeom_Curve) C = EC->EdgeGeometry();

EC becomes NULL here, because second edge in the loop is of type StepShape_OrientedEdge, not StepShape_EdgeCurve.
(0082725)
borm   
2019-03-06 11:56   
Can you please elaborate more on your comment? What does it mean that the application doesn't setup signal? What we need to do?

Still even if we don't setup the signals the code should not crash.
(0083122)
kgv   
2019-03-20 08:31   
Existing test case bugs/step/bug26451 can be used for reproducing the issue.