From: asemenov Date: Fri, 17 Sep 2021 15:46:43 +0000 (+0300) Subject: 0029478: Crash because bSplineSurfaceWithKnots is NULL. X-Git-Tag: V7_6_0_beta~9 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=5dd92c395a9e318b22dec72938963ded423ad37b;p=occt.git 0029478: Crash because bSplineSurfaceWithKnots is NULL. 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 --- diff --git a/src/RWStepGeom/RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface.cxx b/src/RWStepGeom/RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface.cxx index 670c034a72..adc7ba26b3 100644 --- a/src/RWStepGeom/RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface.cxx +++ b/src/RWStepGeom/RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface.cxx @@ -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 index 0000000000..7b17780629 --- /dev/null +++ b/tests/bugs/step/bug29478 @@ -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