PVS-StudioWarnings

PVS-Studio warning V534 for VirtualBox

Nov 20th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. static HRESULT APIENTRY vboxWddmDDevCreateResource(....)
  2. {
  3.   ....
  4.   for (UINT i = 0; i < pResource->SurfCount; ++i)
  5.   {
  6.     ....
  7.     if (SUCCEEDED(hr))
  8.     {
  9.       ....
  10.     }
  11.     else
  12.     {
  13.       for (UINT j = 0; i < j; ++j)
  14.       {
  15.         ....
  16.       }
  17.       break;
  18.     }
  19.   }
  20.   ....
  21. }
  22.  
  23. The error is probably in the "i < j" condition. I think the programmer actually wanted to write j < I.
  24.  
  25. This suspicious code was found in VirtualBox project by PVS-Studio static code analyzer.
  26. Warning message is:
  27. V534 It is likely that a wrong variable is being compared inside the 'for' operator. Consider reviewing 'i'. vboxdispd3d.cpp 4470
  28.  
  29. 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