Advertisement
PVS-StudioWarnings

PVS-Studio warning V512 for Doom3

Nov 26th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. void idAASFileLocal::DeleteClusters( void ) {
  2.   ...
  3.   memset( &portal, 0, sizeof( portal ) );
  4.   portals.Append( portal );
  5.  
  6.   // first cluster is a dummy
  7.   memset( &cluster, 0, sizeof( portal ) );
  8.   clusters.Append( cluster );
  9. }
  10.  
  11. This is what should have been written here:
  12. memset( &cluster, 0, sizeof( cluster ) );
  13.  
  14. This suspicious code was found in Doom3 project by PVS-Studio static code analyzer.
  15. Warning message is:
  16. V512 A call of the 'memset' function will lead to underflow of the buffer '& cluster'. DoomDLL aasfile.cpp 1312
  17.  
  18. 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
Advertisement