1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0027404: Data Exchange - access violation when reading STEP file

Added check on the null handle
Test case for issue CR27404
This commit is contained in:
gka 2016-10-27 17:50:18 +03:00 committed by apn
parent ee905e847d
commit a965c45b2d
2 changed files with 25 additions and 8 deletions

View File

@ -271,14 +271,17 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer()
Handle(StepShape_ShapeRepresentation)::DownCast(RR->Rep1());
if(SR==SR2)
SR2 = Handle(StepShape_ShapeRepresentation)::DownCast(RR->Rep2());
Interface_EntityIterator subs2 = graph.Sharings(SR2);
for(subs2.Start(); subs2.More(); subs2.Next()) {
Handle(StepShape_ShapeDefinitionRepresentation) SDR2 =
Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(subs2.Value());
if(!SDR2.IsNull()) IsRoot = Standard_False;
//else {
// if(SR==SRR->Rep2()) IsRoot = Standard_False;
//}
if(!SR2.IsNull())
{
Interface_EntityIterator subs2 = graph.Sharings(SR2);
for(subs2.Start(); subs2.More(); subs2.Next()) {
Handle(StepShape_ShapeDefinitionRepresentation) SDR2 =
Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(subs2.Value());
if(!SDR2.IsNull()) IsRoot = Standard_False;
//else {
// if(SR==SRR->Rep2()) IsRoot = Standard_False;
//}
}
}
}
}

14
tests/bugs/step/bug27404 Executable file
View File

@ -0,0 +1,14 @@
puts "============"
puts "OCC27404"
puts "============"
puts ""
#######################################################################
# Data Exchange - access violation when reading STEP file
#######################################################################
param read.step.product.mode 0
newmodel
XNewDoc D
ReadStep D [locate_data_file bug27404_pmi.stp]