DiscussionsIssue archiveOCCT:Application Framework

Archived issue #0025537

XmlMPrsStd_PositionDriver::Paste runtime check crash.

CommunityOCCT:Application Frameworkclosed8 public notes

Search issues

Description

void XmlMPrsStd_PositionDriver::Paste
                (const Handle(TDF_Attribute)& theSource,
                 XmlObjMgt_Persistent&        theTarget,
                 XmlObjMgt_SRelocationTable&  ) const
{
  Handle(TDataXtd_Position) aTPos = Handle(TDataXtd_Position)::DownCast(theSource);
  if (!aTPos.IsNull())
  {
    gp_Pnt aPos = aTPos->GetPosition();
    char buf [64];

    // BUG: Run-Time Check Failure #0000002 - Stack around the variable 'buf' was corrupted.
    Sprintf (buf, "%.17g %.17g %.17g", aPos.X(), aPos.Y(), aPos.Z());

    XmlObjMgt::SetStringValue(theTarget.Element(), buf);
  }
}

Steps to reproduce

bugs/caf/bug25537

Public activity

8 archived notes

Participants are labeled by their role within this record.

01Commenter 2
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: mpv
Date: Mon May 22 14:35:57 2017 +0300

    25537: 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.
02Commenter 3
-    char buf [64];
+    char buf[64]; // (24 + 1) * 3

Misprint?
03Commenter 3
Yes. To be checked why tests are passed with this.
04Commenter 2
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: mpv
Date: Mon May 22 15:58:51 2017 +0300

    // update of the fix and test script to be able to reproduce Centroid case too

05Commenter 5
Updated the mentioned cxx and the unit-test. Please, review.
06Commenter 6
Dear Commenter 1,
Branch CR25537 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
[revision removed]

Number of compiler warnings:

occt component :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)

products component :
Linux: 64 (64 on master)
Windows: 0 (0 on master)
MacOS : 1188

Regressions/Differences/Improvements:
No regressions/differences

Testing cases:
http://occt-tests/CR25537-master-OCCT/Debian70-64/bugs/caf/bug25537.html
http://occt-tests/CR25537-master-OCCT/Windows-64-VC10/bugs/caf/bug25537.html
bugs caf bug25537: OK

Testing on Linux:
occt component :
Total MEMORY difference: 91684952 / 91612646 [+0.08%]
Total CPU difference: 18890.89000000025 / 18660.510000000344 [+1.23%]
products component :
Total MEMORY difference: 31357468 / 31347866 [+0.03%]
Total CPU difference: 5415.229999999982 / 5401.239999999972 [+0.26%]
Testing on Windows:
occt component :
Total MEMORY difference: 58430497 / 58426283 [+0.01%]
Total CPU difference: 17815.11139869865 / 17319.43382129878 [+2.86%]
products component :
Total MEMORY difference: 22719531 / 22681228 [+0.17%]
Total CPU difference: 5385.014119099968 / 5370.256424499971 [+0.27%]

There are no differences in images found by testdiff.
07Commenter 7
Dear Commenter 1,
Branch CR25537 is TESTED.
08Commenter 2
Branch [archived branch] has been deleted by Commenter 3.

[revision removed]