PVS-StudioWarnings

PVS-Studio warning V512 for Notepad++

Nov 19th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #define CONT_MAP_MAX 50
  2. int _iContMap[CONT_MAP_MAX];
  3. ...
  4. DockingManager::DockingManager()
  5. {
  6.   ...
  7.   memset(_iContMap, -1, CONT_MAP_MAX);
  8.   ...
  9. }
  10.  
  11. This is what should have been written here: memset(_iContMap, -1, CONT_MAP_MAX * sizeof(int));
  12.  
  13. This suspicious code was found in Notepad++ project by PVS-Studio static code analyzer.
  14. Warning message is:
  15. V512 A call of the memset function will lead to a buffer overflow or underflow
  16.  
  17. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment