0028445: Data Exchange - Opening specific STEP file leads to application crash
authorika <ika@opencascade.com>
Tue, 7 Feb 2017 12:20:29 +0000 (15:20 +0300)
committerapn <apn@opencascade.com>
Thu, 9 Feb 2017 13:16:25 +0000 (16:16 +0300)
Add check for null vertex during translation from STEP.

src/StepToTopoDS/StepToTopoDS_TranslateVertex.cxx
tests/bugs/step/bug26451
tests/bugs/step/bug28256 [new file with mode: 0644]

index a6086563bd08755b766a9b1c7a02171133f23e0c..9d7cf98c61098fd5652324c2cf691529e82f5d36 100644 (file)
@@ -65,6 +65,11 @@ void StepToTopoDS_TranslateVertex::Init(const Handle(StepShape_Vertex)& aVertex,
                                                                StepToTopoDS_Tool& aTool,
                                         StepToTopoDS_NMTool& NMTool)
 {
+  if (aVertex.IsNull()) {
+    myError = StepToTopoDS_TranslateVertexOther;
+    done = Standard_False;
+    return;
+  }
   if (!aTool.IsBound(aVertex)) {
 
     // [BEGIN] Proceed with non-manifold topology (ssv; 14.11.2010)
index 1abbed6d9efba7d998c1addf4a2aadcbbc91c3a7..3d33b9649dec53e2f6fe51a88a32aee22baba200 100644 (file)
@@ -9,20 +9,20 @@ puts ""
 stepread [locate_data_file bug26451_Test_STEP.stp] a *
 tpcompound result
 
-checkprops result -s 550061 
+checkprops result -s 551394 
 checkshape result
 
 set nbshapes_expected "
 Number of shapes in shape
- VERTEX    : 7973
- EDGE      : 8250
- WIRE      : 1950
- FACE      : 1716
- SHELL     : 1716
+ VERTEX    : 8057
+ EDGE      : 8372
+ WIRE      : 1988
+ FACE      : 1754
+ SHELL     : 1754
  SOLID     : 0
  COMPSOLID : 0
  COMPOUND  : 1
- SHAPE     : 21606
+ SHAPE     : 21926
 "
 checknbshapes result -ref ${nbshapes_expected} -t -m "importing file"
 checkview -display result -3d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/step/bug28256 b/tests/bugs/step/bug28256
new file mode 100644 (file)
index 0000000..da63f8e
--- /dev/null
@@ -0,0 +1,27 @@
+puts "========"
+puts "OCC28256"
+puts "========"
+puts ""
+##########################################################################
+# Opening specific STEP file leads to application crash
+##########################################################################
+
+stepread [locate_data_file bug28256_test.stp] a *
+tpcompound result
+
+checkprops result -s 1.8e+101 
+
+set nbshapes_expected "
+Number of shapes in shape
+ VERTEX    : 56881
+ EDGE      : 85310
+ WIRE      : 37795
+ FACE      : 32992
+ SHELL     : 1318
+ SOLID     : 1308
+ COMPSOLID : 0
+ COMPOUND  : 1
+ SHAPE     : 215605
+"
+checknbshapes result -ref ${nbshapes_expected} -t -m "importing file"
+checkview -display result -3d -path ${imagedir}/${test_image}.png
\ No newline at end of file