View Issue Details

IDProjectCategoryView StatusLast Update
0023842CommunityOCCT:Visualizationpublic2013-04-29 15:24
ReporterPawel Assigned Tokgv  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
PlatformAOSL 
Product Version6.4.0 
Target Version6.6.0Fixed in Version6.6.0 
Summary0023842: Undefined behavior: Variable 'thePsFont' is used as parameter and destination in s[n]printf()
DescriptionIn 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.""
TagsNo tags attached.
Test case numberNot needed

Activities

abv

2013-03-20 12:38

manager   ~0023812

The offending code has been introduced in 0023457

kgv

2013-03-20 13:18

developer   ~0023813

Last edited: 2013-03-20 13:18

> The offending code has been introduced in 0023457
No it didn't.

kgv

2013-03-20 15:07

developer   ~0023817

Patch is ready for review in CR23842 branch.

san

2013-03-20 17:32

developer   ~0023826

Branch CR23842 reviewed without remarks, ready for testing.

mkv

2013-03-21 18:24

tester   ~0023839

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.

Related Changesets

occt: master 8b224a09

2013-03-20 11:06:32

kgv

Details Diff
0023842: Undefined behavior: Variable 'thePsFont' is used as parameter and destination in s[n]printf() Affected Issues
0023842
mod - src/OpenGl/OpenGl_Text.cxx Diff File

Issue History

Date Modified Username Field Change
2013-03-20 12:27 Pawel New Issue
2013-03-20 12:27 Pawel Assigned To => bugmaster
2013-03-20 12:38 abv Note Added: 0023812
2013-03-20 12:38 abv Assigned To bugmaster => kgv
2013-03-20 12:38 abv Status new => assigned
2013-03-20 12:38 abv Relationship added child of 0023457
2013-03-20 12:39 abv Target Version 6.7.0 => 6.6.0
2013-03-20 13:18 kgv Note Added: 0023813
2013-03-20 13:18 kgv Product Version 6.5.4 => 6.4.0
2013-03-20 13:18 kgv Note Edited: 0023813
2013-03-20 15:07 kgv Note Added: 0023817
2013-03-20 15:07 kgv Assigned To kgv => san
2013-03-20 15:07 kgv Status assigned => resolved
2013-03-20 17:32 san Note Added: 0023826
2013-03-20 17:32 san Assigned To san => bugmaster
2013-03-20 17:32 san Status resolved => reviewed
2013-03-20 18:21 mkv Assigned To bugmaster => mkv
2013-03-21 08:29 kgv Relationship deleted child of 0023457
2013-03-21 18:24 mkv Note Added: 0023839
2013-03-21 18:24 mkv Test case number => Not needed
2013-03-21 18:24 mkv Assigned To mkv => bugmaster
2013-03-21 18:24 mkv Status reviewed => tested
2013-03-25 18:39 kgv Changeset attached => occt master 8b224a09
2013-03-25 18:39 kgv Assigned To bugmaster => kgv
2013-03-25 18:39 kgv Status tested => verified
2013-03-25 18:39 kgv Resolution open => fixed
2013-04-23 13:35 aiv Status verified => closed
2013-04-29 15:24 aiv Fixed in Version => 6.6.0