Advertisement
PVS-StudioWarnings

PVS-Studio warning V512 for Doom3

Nov 24th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. aseMesh_t *currentMesh;
  2.  
  3. static void ASE_KeyGEOMOBJECT( const char *token )
  4. {
  5.   ...
  6.   ase.currentMesh = &ase.currentObject->mesh;
  7.   memset( ase.currentMesh, 0, sizeof( ase.currentMesh ) );
  8.   ...
  9. }
  10.  
  11. This is what should have been written here:
  12. memset( ase.currentMesh, 0, sizeof( *ase.currentMesh ) );
  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 'ase.currentMesh'. DoomDLL model_ase.cpp 731
  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