PVS-StudioWarnings

PVS-Studio warning V579 for ffdshow

Nov 11th, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. TprintPrefs::TprintPrefs(IffdshowBase *Ideci,
  2.                          const TfontSettings *IfontSettings)
  3. {
  4.   // This doesn't seem to help after optimization.
  5.   memset(this, 0, sizeof(this));
  6.   dx = dy = 0;
  7.   isOSD = false;
  8.   xpos = ypos = 0;
  9.   align = 0;
  10.   linespacing = 0;
  11.   sizeDx = 0;
  12.   sizeDy = 0;
  13.   ...
  14. }
  15.  
  16. Super! As always, the compiler is to blame. This is what should have been written here: sizeof(*this).
  17.  
  18. This suspicious code was found in ffdshow project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V579 The memset function receives the pointer and its size as arguments. It is possibly a mistake. Inspect the third argument. tfont.cpp 44
  21.  
  22. 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