1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0024759: Crash on STEP import, when reading a file exported in non-"C" locale

Fix for step reading
Add test case bugs/xde/bug24759
This commit is contained in:
dbv 2014-04-10 20:13:01 +04:00 committed by apn
parent ca0c0b11ac
commit 4fc7830275
2 changed files with 16 additions and 3 deletions

View File

@ -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]);
}

13
tests/bugs/xde/bug24759 Normal file
View File

@ -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 *