]> OCCT Git - occt.git/commitdiff
0033307: Data Exchange, Step Import - Crash after reading empty edge loop
authordpasukhi <dpasukhi@opencascade.com>
Wed, 11 Jan 2023 11:29:08 +0000 (11:29 +0000)
committerVadim Glukhikh <vadim.glukhikh@opencascade.com>
Wed, 1 Feb 2023 00:09:26 +0000 (00:09 +0000)
Fixed problem with empty edge list in the edge loop, mark as a fail entity in this case

src/RWStepShape/RWStepShape_RWEdgeLoop.cxx
tests/bugs/step/bug33307 [new file with mode: 0644]

index dd0097813b2479ff54ca74cb33b1aa68fb83443f..f6cc79a34fb743e9fe7b2ce9920b4baeb439f447 100644 (file)
@@ -106,6 +106,11 @@ void RWStepShape_RWEdgeLoop::Check
   Standard_Boolean headToTail = Standard_True;
   //Standard_Boolean noIdentVtx = Standard_True; //szv#4:S4163:12Mar99 unused
   Standard_Integer nbEdg = ent->NbEdgeList();
+  if (nbEdg == 0)
+  {
+    ach->AddFail("Edge loop contains empty edge list");
+    return;
+  }
   Handle(StepShape_OrientedEdge) theOE = ent->EdgeListValue(1);
   Handle(StepShape_Vertex) theVxFrst = theOE->EdgeStart();
   Handle(StepShape_Vertex) theVxLst  = theOE->EdgeEnd();
diff --git a/tests/bugs/step/bug33307 b/tests/bugs/step/bug33307
new file mode 100644 (file)
index 0000000..feeb6be
--- /dev/null
@@ -0,0 +1,11 @@
+puts "==================================================="
+puts "0033307: Data Exchange, Step Import - Crash after reading empty edge loop"
+puts "==================================================="
+puts ""
+
+pload XDE OCAF
+
+Close D -silent
+
+ReadStep D [locate_data_file "bug33307.stp"]
+Close D