mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0030533: Data Exchange - Crash during STEP import.
Add Null checks to avoid crash during reading faces without bounds.
This commit is contained in:
parent
6ef0d6f156
commit
7b93ae3c5e
@ -4547,6 +4547,8 @@ void STEPCAFControl_Reader::ExpandShell(const Handle(StepShape_ConnectedFaceSet)
|
|||||||
|
|
||||||
// Access face bounds
|
// Access face bounds
|
||||||
Handle(StepShape_HArray1OfFaceBound) aWires = aFace->Bounds();
|
Handle(StepShape_HArray1OfFaceBound) aWires = aFace->Bounds();
|
||||||
|
if (aWires.IsNull())
|
||||||
|
continue;
|
||||||
for (Standard_Integer w = aWires->Lower(); w <= aWires->Upper(); ++w)
|
for (Standard_Integer w = aWires->Lower(); w <= aWires->Upper(); ++w)
|
||||||
{
|
{
|
||||||
const Handle(StepShape_Loop)& aWire = aWires->Value(w)->Bound();
|
const Handle(StepShape_Loop)& aWire = aWires->Value(w)->Bound();
|
||||||
@ -4564,7 +4566,12 @@ void STEPCAFControl_Reader::ExpandShell(const Handle(StepShape_ConnectedFaceSet)
|
|||||||
Handle(StepShape_HArray1OfOrientedEdge) anEdges = anEdgeLoop->EdgeList();
|
Handle(StepShape_HArray1OfOrientedEdge) anEdges = anEdgeLoop->EdgeList();
|
||||||
for (Standard_Integer e = anEdges->Lower(); e <= anEdges->Upper(); ++e)
|
for (Standard_Integer e = anEdges->Lower(); e <= anEdges->Upper(); ++e)
|
||||||
{
|
{
|
||||||
Handle(StepShape_Edge) anEdge = anEdges->Value(e)->EdgeElement();
|
Handle(StepShape_OrientedEdge) anOrientedEdge = anEdges->Value(e);
|
||||||
|
if (anOrientedEdge.IsNull())
|
||||||
|
continue;
|
||||||
|
Handle(StepShape_Edge) anEdge = anOrientedEdge->EdgeElement();
|
||||||
|
if (anEdge.IsNull())
|
||||||
|
continue;
|
||||||
|
|
||||||
// Record CAF data
|
// Record CAF data
|
||||||
SettleShapeData(anEdge, RootLab, ShapeTool, TP);
|
SettleShapeData(anEdge, RootLab, ShapeTool, TP);
|
||||||
|
25
tests/bugs/step/bug30533
Normal file
25
tests/bugs/step/bug30533
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
puts "==================================================="
|
||||||
|
puts " 0030533: Data Exchange - Crash during STEP import."
|
||||||
|
puts "==================================================="
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
pload DCAF
|
||||||
|
|
||||||
|
param read.stepcaf.subshapes.name On
|
||||||
|
|
||||||
|
ReadStep D [locate_data_file bug30533.stp]
|
||||||
|
|
||||||
|
# Check imported names
|
||||||
|
set name [GetName D 0:1:1:5:1]
|
||||||
|
if {$name != "NONE"} {
|
||||||
|
puts "Error: wrong name of subshape"
|
||||||
|
}
|
||||||
|
set name [GetName D 0:1:1:5:2]
|
||||||
|
if {$name != "NONE"} {
|
||||||
|
puts "Error: wrong name of subshape"
|
||||||
|
}
|
||||||
|
|
||||||
|
Close D
|
||||||
|
|
||||||
|
# return param to default value
|
||||||
|
param read.stepcaf.subshapes.name Off
|
Loading…
x
Reference in New Issue
Block a user