View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0033377 | Community | OCCT:Data Exchange | public | 2023-05-10 21:18 | 2023-12-18 18:33 |
Reporter | FrancoisLauzon | Assigned To | dpasukhi | ||
Priority | normal | Severity | crash | ||
Status | verified | Resolution | fixed | ||
Platform | Windows | OS | VC++ 2019 | ||
Product Version | 7.6.3 | ||||
Target Version | 7.7.2 | ||||
Summary | 0033377: Data Exchange - STEPCAFControl_Reader crash in OCC 7.7.0 | ||||
Description | When importing a particular STEP file, the method STEPCAFControl_Reader::ExpandShell() crash when encountering and using a null StepShape_Vertex. I tested the same step file with CAD Assistant 1.6 (which use OCC 7.6) and it doesn't crash. I cannot supplied the step file in question, but I manage to fix STEPCAFControl_Reader and then successfully import the file. | ||||
Steps To Reproduce | Not possible | ||||
Additional information and documentation updates | Here are the 2 methods that I changed to fix the crash (simply add a test for null pointer):void STEPCAFControl_Reader::ExpandShell(const Handle(StepShape_ConnectedFaceSet)& Shell, TDF_Label& RootLab, const Handle(Transfer_TransientProcess)& TP, const Handle(XCAFDoc_ShapeTool)& ShapeTool) const { // Record CAF data SettleShapeData(Shell, RootLab, ShapeTool, TP); // Access faces Handle(StepShape_HArray1OfFace) aFaces = Shell->CfsFaces(); for (Standard_Integer f = aFaces->Lower(); f <= aFaces->Upper(); ++f) { const Handle(StepShape_Face)& aFace = aFaces->Value(f); if (aFace.IsNull()) continue; // Record CAF data SettleShapeData(aFace, RootLab, ShapeTool, TP); // Access face bounds Handle(StepShape_HArray1OfFaceBound) aWires = aFace->Bounds(); if (aWires.IsNull()) continue; for (Standard_Integer w = aWires->Lower(); w <= aWires->Upper(); ++w) { const Handle(StepShape_Loop)& aWire = aWires->Value(w)->Bound(); // Record CAF data SettleShapeData(aWire, RootLab, ShapeTool, TP); // Access wire edges // Currently only EDGE LOOPs are considered (!) if (!aWire->IsInstance(STANDARD_TYPE(StepShape_EdgeLoop))) continue; // Access edges Handle(StepShape_EdgeLoop) anEdgeLoop = Handle(StepShape_EdgeLoop)::DownCast(aWire); Handle(StepShape_HArray1OfOrientedEdge) anEdges = anEdgeLoop->EdgeList(); for (Standard_Integer e = anEdges->Lower(); e <= anEdges->Upper(); ++e) { Handle(StepShape_OrientedEdge) anOrientedEdge = anEdges->Value(e); if (anOrientedEdge.IsNull()) continue; Handle(StepShape_Edge) anEdge = anOrientedEdge->EdgeElement(); if (anEdge.IsNull()) continue; // Record CAF data SettleShapeData(anEdge, RootLab, ShapeTool, TP); // Access vertices Handle(StepShape_Vertex) aV1 = anEdge->EdgeStart(); Handle(StepShape_Vertex) aV2 = anEdge->EdgeEnd(); // Record CAF data if (aV1.IsNull()==false) SettleShapeData(aV1, RootLab, ShapeTool, TP); if (aV2.IsNull()==false) SettleShapeData(aV2, RootLab, ShapeTool, TP); } } } } //======================================================================= //function : SettleShapeData //purpose : //======================================================================= TDF_Label STEPCAFControl_Reader_priv::SettleShapeData(const Handle(StepRepr_RepresentationItem)& theItem, const TDF_Label& theLab, const Handle(XCAFDoc_ShapeTool)& theShapeTool, const Handle(Transfer_TransientProcess)& TP) const { TDF_Label aResult = theLab; if (theItem.IsNull()) return aResult; Handle(TCollection_HAsciiString) hName = theItem->Name(); if (hName.IsNull() || hName->IsEmpty()) return aResult; Handle(Transfer_Binder) aBinder = TP->Find(theItem); if (aBinder.IsNull()) return aResult; TopoDS_Shape aShape = TransferBRep::ShapeResult(aBinder); if (aShape.IsNull()) return aResult; // Allocate sub-Label aResult = theShapeTool->AddSubShape(theLab, aShape); if (aResult.IsNull()) return aResult; TCollection_AsciiString aName = hName->String(); TDataStd_Name::Set(aResult, aName); theShapeTool->SetShape(aResult, aShape); return aResult; } | ||||
Tags | No tags attached. | ||||
Test case number | |||||
|
Branch CR33377 has been created by dpasukhi. SHA-1: e4f00dbb7e72cc187215666ad949c54526ece6f0 Detailed log of new commits: Author: dpasukhi Date: Wed May 10 19:26:55 2023 +0100 0033377: Data Exchange - STEPCAFControl_Reader crash in OCC 7.7.0 Added checking for null object for STEPCAFControl_Reader::SettleShapeData |
|
Dear ika, please review CR33377 There is just new checking for null object. I think that this happened on not valid file, but as a fact we need to avoid crash. Tests are not needed. |
|
No remarks. Dear bugmaster, please integrate OCCT - CR33377 |
|
Combination - OCCT branch : IR-2023-05-12 Products branch : IR-2023-05-12 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: Ubuntu2004-64: OCCT Total CPU difference: 18189.300000000207 / 18355.18000000007 [-0.90%] Products Total CPU difference: 12137.909999999983 / 12171.56000000001 [-0.28%] Windows-64-VC142: OCCT Total CPU difference: 19812.3125 / 20719.140625 [-4.38%] Products Total CPU difference: 5352.15625 / 5404.359375 [-0.97%] Image differences : No differences that require special attention Memory differences : No differences that require special attention |
|
Branch CR33377 has been deleted by vglukhik. SHA-1: e4f00dbb7e72cc187215666ad949c54526ece6f0 |
Date Modified | Username | Field | Change |
---|---|---|---|
2023-05-10 21:18 | FrancoisLauzon | New Issue | |
2023-05-10 21:18 | FrancoisLauzon | Assigned To | => ika |
2023-05-10 21:22 | dpasukhi | Target Version | => 7.7.2 |
2023-05-10 21:22 | dpasukhi | Summary | STEPCAFControl_Reader crash in OCC 7.7.0 => Data Exchange - STEPCAFControl_Reader crash in OCC 7.7.0 |
2023-05-10 21:22 | dpasukhi | Additional Information Updated | |
2023-05-10 21:29 | git | Note Added: 0113453 | |
2023-05-10 21:31 | dpasukhi | Status | new => resolved |
2023-05-10 21:31 | dpasukhi | Steps to Reproduce Updated | |
2023-05-10 21:31 | dpasukhi | Note Added: 0113454 | |
2023-05-11 15:44 | ika | Assigned To | ika => bugmaster |
2023-05-11 15:44 | ika | Status | resolved => reviewed |
2023-05-11 15:44 | ika | Note Added: 0113459 | |
2023-05-15 16:34 | vglukhik | Note Added: 0113485 | |
2023-05-15 16:38 | dpasukhi | Changeset attached | => occt master e4f00dbb |
2023-05-15 16:38 | dpasukhi | Assigned To | bugmaster => dpasukhi |
2023-05-15 16:38 | dpasukhi | Status | reviewed => verified |
2023-05-15 16:38 | dpasukhi | Resolution | open => fixed |
2023-12-18 18:33 | git | Note Added: 0114811 |