From: dbv Date: Thu, 10 Apr 2014 16:13:01 +0000 (+0400) Subject: 0024759: Crash on STEP import, when reading a file exported in non-"C" locale X-Git-Tag: V6_8_0_beta~406 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=4fc7830275bc423feebcb0468877910ef89d6f37;p=occt-copy.git 0024759: Crash on STEP import, when reading a file exported in non-"C" locale Fix for step reading Add test case bugs/xde/bug24759 --- diff --git a/src/RWStepGeom/RWStepGeom_RWCartesianPoint.cxx b/src/RWStepGeom/RWStepGeom_RWCartesianPoint.cxx index d234696053..429f67e0f9 100644 --- a/src/RWStepGeom/RWStepGeom_RWCartesianPoint.cxx +++ b/src/RWStepGeom/RWStepGeom_RWCartesianPoint.cxx @@ -52,8 +52,8 @@ void RWStepGeom_RWCartesianPoint::ReadStep if(nb2 > 3) { ach->AddWarning("More than 3 coordinates, ignored"); } - nbcoord = nb2; - for (Standard_Integer i2 = 0; i2 < nb2; i2 ++) { + nbcoord = Min (nb2, 3); + for (Standard_Integer i2 = 0; i2 < nbcoord; i2 ++) { if (data->ReadReal (nsub2,i2+1,"coordinates",ach,aCoordinatesItem)) { XYZ[i2] = aCoordinatesItem; } @@ -64,7 +64,7 @@ void RWStepGeom_RWCartesianPoint::ReadStep // ent->Init(aName, aCoordinates); - if (nbcoord >= 3) ent->Init3D (aName, XYZ[0],XYZ[1],XYZ[2]); + if (nbcoord == 3) ent->Init3D (aName, XYZ[0],XYZ[1],XYZ[2]); else ent->Init2D (aName, XYZ[0],XYZ[1]); } diff --git a/tests/bugs/xde/bug24759 b/tests/bugs/xde/bug24759 new file mode 100644 index 0000000000..b8be26c162 --- /dev/null +++ b/tests/bugs/xde/bug24759 @@ -0,0 +1,13 @@ +puts "================" +puts "OCC24759" +puts "================" +puts "" +########################################################################## +# Crash on STEP import, when reading a file exported is non-"C" locale +########################################################################## + +decho off +stepread [locate_data_file bug24759_FissionMeter.step] aaa f * + + +