MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0029252Open CASCADE[OCCT] OCCT:Codingpublic2017-10-21 21:072018-06-29 21:19
Reporterkgv 
Assigned Tobugmaster 
PrioritynormalSeverityminor 
StatusclosedResolutionfixed 
PlatformLinuxOSUbuntu 17.10OS Version64 bit
Product Version[OCCT] 7.2.0 
Target Version[OCCT] 7.3.0Fixed in Version[OCCT] 7.3.0 
Summary0029252: Coding rules - eliminate GCC compiler warnings -Wformat-overflow
DescriptionThe following GCC 7.2.0 compiler warnings should be eliminated.
/occt.git/src/OSD/OSD_DirectoryIterator.cxx: In member function ‘void OSD_DirectoryIterator::Next()’:

/occt.git/src/OSD/OSD_DirectoryIterator.cxx:100:6: warning: ‘%s’ directive writing up to 255 bytes 
into a region of size 254 [-Wformat-overflow=]
 void OSD_DirectoryIterator::Next(){
      ^~~~~~~~~~~~~~~~~~~~~
/occt.git/src/OSD/OSD_DirectoryIterator.cxx:123:13: note: ‘sprintf’ output 2 or more bytes (assuming 
257) into a destination of size 255
      sprintf(full_name,"%s/%s",myPlace.ToCString(),
      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       ((struct dirent *)myEntry)->d_name);   // LD debug
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/occt.git/src/OSD/OSD_FileIterator.cxx: In member function ‘void OSD_FileIterator::Next()’:
/occt.git/src/OSD/OSD_FileIterator.cxx:176:6: warning: ‘%s’ directive writing up to 255 bytes into 
a region of size 254 [-Wformat-overflow=]
 void OSD_FileIterator::Next(){
      ^~~~~~~~~~~~~~~~
/occt.git/src/OSD/OSD_FileIterator.cxx:199:13: note: ‘sprintf’ output 2 or more bytes (assuming 257) 
into a destination of size 255
      sprintf(full_name,"%s/%s",myPlace.ToCString(),
      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       ((struct dirent *)myEntry)->d_name);   // LD debug
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

||=== Build finished: 0 error(s), 2 warning(s) (17 minute(s), 37 second(s)) ===|
TagsNo tags attached.
Test case numberNot required
Attached Files

- Relationships
related to 0029834verifiedbugmaster Coding Rules - eliminate GCC compiler warnings -Wformat-overflow in IGESData_IGESWriter 

-  Notes
(0071677)
git (administrator)
2017-10-21 21:17

Branch CR29252 has been created by kgv.

SHA-1: 5f2ddbf140ebec9e6836b287c6a3617fbdd7a8c3


Detailed log of new commits:

Author: kgv
Date: Sat Oct 21 21:17:14 2017 +0300

    0029252: Coding rules - eliminate GCC compiler warnings -Wformat-overflow
    
    OSD_DirectoryIterator and OSD_FileIterator now uses TCollection_AsciiString instead of unsafe sprintf.
(0071678)
kgv (developer)
2017-10-21 21:19

Patch is ready for review.
(0071680)
abv (manager)
2017-10-21 22:01

Reviewed, please test.

A side note is: function readdir used in the affected code is not reentrant; thread-safe version exist, called readdir_r.
(0071682)
kgv (developer)
2017-10-21 22:45

> A side note is: function readdir used in the affected code is not reentrant;
> thread-safe version exist, called readdir_r.
readdir_r has bad design and is deprecated within glibc:
http://man7.org/linux/man-pages/man3/readdir_r.3.html [^]
(0071748)
bugmaster (administrator)
2017-10-24 16:09

Combination -
OCCT branch : CR29252 SHA-1: 5f2ddbf140ebec9e6836b287c6a3617fbdd7a8c3
Products branch : master
was compiled on Linux, MacOS and Windows platforms and tested on optimize mode on jenkins-test-10 and jenkins-tets-08.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
No differences that require special attention

Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
(0072080)
git (administrator)
2017-11-08 18:24

Branch CR29252 has been deleted by kgv.

SHA-1: 5f2ddbf140ebec9e6836b287c6a3617fbdd7a8c3

- Related Changesets
occt: master 65ada1f1
Timestamp: 2017-10-21 18:17:14
Author: kgv
Committer: bugmaster
Details ] Diff ]
0029252: Coding rules - eliminate GCC compiler warnings -Wformat-overflow

OSD_DirectoryIterator and OSD_FileIterator now uses TCollection_AsciiString instead of unsafe sprintf.
mod - src/OSD/OSD_DirectoryIterator.cxx Diff ] File ]
mod - src/OSD/OSD_FileIterator.cxx Diff ] File ]

- Issue History
Date Modified Username Field Change
2017-10-21 21:07 kgv New Issue
2017-10-21 21:07 kgv Assigned To => kgv
2017-10-21 21:08 kgv OS Ubuntu 17.04 => Ubuntu 17.10
2017-10-21 21:10 kgv Description Updated View Revisions
2017-10-21 21:17 git Note Added: 0071677
2017-10-21 21:19 kgv Note Added: 0071678
2017-10-21 21:19 kgv Assigned To kgv => abv
2017-10-21 21:19 kgv Status new => resolved
2017-10-21 22:01 abv Note Added: 0071680
2017-10-21 22:01 abv Assigned To abv => bugmaster
2017-10-21 22:01 abv Status resolved => reviewed
2017-10-21 22:45 kgv Note Added: 0071682
2017-10-24 16:09 bugmaster Note Added: 0071748
2017-10-24 16:09 bugmaster Status reviewed => tested
2017-10-24 18:50 bugmaster Test case number => Not required
2017-10-27 09:54 bugmaster Changeset attached => occt master 65ada1f1
2017-10-27 09:54 bugmaster Status tested => verified
2017-10-27 09:54 bugmaster Resolution open => fixed
2017-11-08 18:24 git Note Added: 0072080
2018-02-20 12:58 aiv Target Version 7.4.0* => 7.3.0
2018-06-02 14:24 kgv Relationship added related to 0029834
2018-06-29 21:13 aiv Fixed in Version => 7.3.0
2018-06-29 21:19 aiv Status verified => closed


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker