PVS-StudioWarnings

PVS-Studio warning V514 for Notepad++

Nov 26th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. typedef struct tagTVITEMA {
  2.   ...
  3.   LPSTR     pszText;
  4.   ...
  5. } TVITEMA, *LPTVITEMA;
  6.  
  7. #define TVITEM TVITEMA
  8.  
  9. HTREEITEM TreeView::addItem(....)
  10. {
  11.   TVITEM tvi;
  12.   ...
  13.   tvi.cchTextMax = sizeof(tvi.pszText)/sizeof(tvi.pszText[0]);
  14.   ...
  15. }
  16.  
  17. This suspicious code was found in Notepad++ project by PVS-Studio static code analyzer.
  18. Warning message is:
  19. V514 Dividing sizeof a pointer 'sizeof (tvi.pszText)' by another value. There is a probability of logical error presence.  Notepad++  treeview.cpp  88
  20.  
  21. 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