PVS-StudioWarnings

PVS-Studio warning V595 for Doom3

Nov 20th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. void idBrushBSP::FloodThroughPortals_r(idBrushBSPNode *node, ...)
  2. {
  3.   ...
  4.   if ( node->occupied ) {
  5.     common->Error(
  6.       "FloodThroughPortals_r: node already occupied\n" );
  7.   }
  8.   if ( !node ) {
  9.     common->Error(
  10.       "FloodThroughPortals_r: NULL node\n" );
  11.   }
  12.   ...
  13. }
  14.  
  15. This is what should have been written here: if ( node && node->occupied ) {
  16.  
  17. This suspicious code was found in Doom3 project by PVS-Studio static code analyzer.
  18. Warning message is:
  19. V595 The 'node' pointer was utilized before it was verified against nullptr. Check lines: 1421, 1424. DoomDLL brushbsp.cpp 1421
  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