mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-24 13:50:49 +03:00
0024759: Crash on STEP import, when reading a file exported in non-"C" locale
Fix for step reading: protection against memory buffer overrun when parsing list of reals written with comma as radix
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user