mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0025537: XmlMPrsStd_PositionDriver::Paste runtime check crash.
Increased a size of buffer in array of 'char' to fit the largest possible conversion from 'double' to %.17g string.
This commit is contained in:
parent
87432b8278
commit
a38db39de6
@ -122,7 +122,7 @@ void XmlMDataXtd_PositionDriver::Paste
|
|||||||
if (!aTPos.IsNull())
|
if (!aTPos.IsNull())
|
||||||
{
|
{
|
||||||
gp_Pnt aPos = aTPos->GetPosition();
|
gp_Pnt aPos = aTPos->GetPosition();
|
||||||
char buf [64];
|
char buf [75]; // (24 + 1) * 3
|
||||||
Sprintf (buf, "%.17g %.17g %.17g", aPos.X(), aPos.Y(), aPos.Z());
|
Sprintf (buf, "%.17g %.17g %.17g", aPos.X(), aPos.Y(), aPos.Z());
|
||||||
XmlObjMgt::SetStringValue(theTarget.Element(), buf);
|
XmlObjMgt::SetStringValue(theTarget.Element(), buf);
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ void XmlMXCAFDoc_CentroidDriver::Paste
|
|||||||
if (!aTPos.IsNull())
|
if (!aTPos.IsNull())
|
||||||
{
|
{
|
||||||
gp_Pnt aPos = aTPos->Get();
|
gp_Pnt aPos = aTPos->Get();
|
||||||
char buf [64];
|
char buf[75]; // (24 + 1) * 3
|
||||||
Sprintf (buf, "%.17g %.17g %.17g", aPos.X(), aPos.Y(), aPos.Z());
|
Sprintf (buf, "%.17g %.17g %.17g", aPos.X(), aPos.Y(), aPos.Z());
|
||||||
XmlObjMgt::SetStringValue(theTarget.Element(), buf);
|
XmlObjMgt::SetStringValue(theTarget.Element(), buf);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ XmlObjMgt_DOMString XmlObjMgt_GP::Translate (const gp_Mat& aMat)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
XmlObjMgt_DOMString XmlObjMgt_GP::Translate (const gp_XYZ& anXYZ)
|
XmlObjMgt_DOMString XmlObjMgt_GP::Translate (const gp_XYZ& anXYZ)
|
||||||
{
|
{
|
||||||
char buf [64];
|
char buf [75]; // (24 + 1) * 3
|
||||||
Sprintf (buf, "%.17g %.17g %.17g", anXYZ.X(), anXYZ.Y(), anXYZ.Z());
|
Sprintf (buf, "%.17g %.17g %.17g", anXYZ.X(), anXYZ.Y(), anXYZ.Z());
|
||||||
return XmlObjMgt_DOMString (buf);
|
return XmlObjMgt_DOMString (buf);
|
||||||
}
|
}
|
||||||
|
29
tests/bugs/caf/bug25537
Normal file
29
tests/bugs/caf/bug25537
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC25537"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# XmlMPrsStd_PositionDriver::Paste runtime check crash.
|
||||||
|
#######################################################################
|
||||||
|
pload XDEDRAW
|
||||||
|
|
||||||
|
NewDocument Doc XmlXCAF
|
||||||
|
|
||||||
|
# number that takes 24 symbols in %.17g string
|
||||||
|
set aBigNum -0.0000000000123456789123456789
|
||||||
|
|
||||||
|
# Create TDataXtd_Position and XCAFDoc_Centroid attributes (same problem in writing XML)
|
||||||
|
# 100 labels to have a stable exception (memory corruption)
|
||||||
|
for {set i 1} {$i < 100} {incr i} {
|
||||||
|
set aLab1 0:1:$i
|
||||||
|
SetPosition Doc $aLab1 $aBigNum $aBigNum $aBigNum
|
||||||
|
set aLab2 0:2:$i
|
||||||
|
Label Doc $aLab2
|
||||||
|
XSetCentroid Doc $aLab2 $aBigNum $aBigNum $aBigNum
|
||||||
|
}
|
||||||
|
|
||||||
|
set aFile ${imagedir}/bug25537_test.xml
|
||||||
|
SaveAs Doc ${aFile}
|
||||||
|
|
||||||
|
## ==> No exception
|
||||||
|
Close Doc
|
Loading…
x
Reference in New Issue
Block a user