MantisBT - Community
View Issue Details
0023842Community[OCCT] OCCT:Visualizationpublic2013-03-20 12:272013-04-29 15:24
Pawel 
kgv 
normalminor 
closedfixed 
ALL
[OCCT] 6.4.0 
[OCCT] 6.6.0[OCCT] 6.6.0 
Not needed
0023842: Undefined behavior: Variable 'thePsFont' is used as parameter and destination in s[n]printf()
In OpenGl_Text.cxx, line 96:

sprintf (thePsFont, "%s%s", thePsFont, TheItalic[aFontId]);

cppcheck message:
"The variable 'thePsFont' is used both as a parameter and as destination in s[n]printf(). The origin and destination buffers overlap. Quote from glibc (C-library) documentation (http://www.gnu.org/software/libc/manual/html_mono/libc.html#Formatted-Output-Functions [^]): "If copying takes place between objects that overlap as a result of a call to sprintf() or snprintf(), the results are undefined.""
No tags attached.
Issue History
2013-03-20 12:27PawelNew Issue
2013-03-20 12:27PawelAssigned To => bugmaster
2013-03-20 12:38abvNote Added: 0023812
2013-03-20 12:38abvAssigned Tobugmaster => kgv
2013-03-20 12:38abvStatusnew => assigned
2013-03-20 12:38abvRelationship addedchild of 0023457
2013-03-20 12:39abvTarget Version6.7.0 => 6.6.0
2013-03-20 13:18kgvNote Added: 0023813
2013-03-20 13:18kgvProduct Version6.5.4 => 6.4.0
2013-03-20 13:18kgvNote Edited: 0023813bug_revision_view_page.php?bugnote_id=23813#r5210
2013-03-20 15:07kgvNote Added: 0023817
2013-03-20 15:07kgvAssigned Tokgv => san
2013-03-20 15:07kgvStatusassigned => resolved
2013-03-20 17:32sanNote Added: 0023826
2013-03-20 17:32sanAssigned Tosan => bugmaster
2013-03-20 17:32sanStatusresolved => reviewed
2013-03-20 18:21mkvAssigned Tobugmaster => mkv
2013-03-21 08:29kgvRelationship deletedchild of 0023457
2013-03-21 18:24mkvNote Added: 0023839
2013-03-21 18:24mkvTest case number => Not needed
2013-03-21 18:24mkvAssigned Tomkv => bugmaster
2013-03-21 18:24mkvStatusreviewed => tested
2013-03-25 18:39kgvChangeset attached => occt master 8b224a09
2013-03-25 18:39kgvAssigned Tobugmaster => kgv
2013-03-25 18:39kgvStatustested => verified
2013-03-25 18:39kgvResolutionopen => fixed
2013-04-23 13:35aivStatusverified => closed
2013-04-29 15:24aivFixed in Version => 6.6.0

Notes
(0023812)
abv   
2013-03-20 12:38   
The offending code has been introduced in 0023457
(0023813)
kgv   
2013-03-20 13:18   
> The offending code has been introduced in 0023457
No it didn't.

(0023817)
kgv   
2013-03-20 15:07   
Patch is ready for review in CR23842 branch.
(0023826)
san   
2013-03-20 17:32   
Branch CR23842 reviewed without remarks, ready for testing.
(0023839)
mkv   
2013-03-21 18:24   
Dear BugMaster,

Branch CR23842 (and products from GIT master) was compiled on Linux and Windows platforms and tested without rebase.
SHA-1: 6903904a719f26c7f17d93bfd0a31a1208d68f98

Number of compiler warnings:

occt component :
Linux: 3 (3 on master)
Windows: 11 (11 on master)

products component :
Linux: 0 (0 on master)
Windows: 50 (50 on master)

Regressions:
No regressions

Improvements:
No improvements

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 243477684 / 241671364
Total CPU difference: 17405.350000000162 / 14694.200000000103

Testing on Windows:
Total MEMORY difference: 352774980 / 354810080
Total CPU difference: 21124.578125 / 22916.015625

There are not serious differences in images found by testdiff.