]> OCCT Git - occt.git/commitdiff
0029478: Crash because bSplineSurfaceWithKnots is NULL.
authorasemenov <asemenov_ext@opencascade.com>
Fri, 17 Sep 2021 15:46:43 +0000 (18:46 +0300)
committersmoskvin <smoskvin@opencascade.com>
Mon, 20 Sep 2021 17:03:49 +0000 (20:03 +0300)
Modified the method void RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface::ReadStep
Added processing B spline surface with knots and rational B spline surface with empty data in the name field
Added test

src/RWStepGeom/RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface.cxx
tests/bugs/step/bug29478 [new file with mode: 0644]

index 670c034a7219a0a40ed403c8777783bf2cbcc0b5..adc7ba26b397af0b3c14009376c318bf8e18980f 100644 (file)
@@ -261,15 +261,21 @@ void RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface::ReadStep
 
        // --- Instance of plex component RepresentationItem ---
 
-       if (!data->CheckNbParams(num,1,ach,"representation_item")) return;
-
        // --- field : name ---
 
        Handle(TCollection_HAsciiString) aName;
-       //szv#4:S4163:12Mar99 `Standard_Boolean stat14 =` not needed
-       data->ReadString (num,1,"name",ach,aName);
 
-//     num = data->NextForComplex(num);
+  if (!data->CheckNbParams(num, 1, ach, "representation_item"))
+  {
+    aName = new TCollection_HAsciiString("");
+  }
+  else
+  {
+    //szv#4:S4163:12Mar99 `Standard_Boolean stat14 =` not needed
+    data->ReadString(num, 1, "name", ach, aName);
+  }
+
+  //   num = data->NextForComplex(num);
        data->NamedForComplex("SURFACE", "SRFC",num0,num,ach);
 
        //--- Initialisation of the red entity ---
diff --git a/tests/bugs/step/bug29478 b/tests/bugs/step/bug29478
new file mode 100644 (file)
index 0000000..7b17780
--- /dev/null
@@ -0,0 +1,11 @@
+puts "============"
+puts "OCC29478"
+puts "============"
+puts ""
+#####################################################
+# Crash because bSplineSurfaceWithKnots is NULL
+#####################################################
+
+set aFilePath [locate_data_file bug29478.stp]
+testreadstep "$aFilePath" orig
+checkshape orig