PVS-StudioWarnings

PVS-Studio warning V547 for Shareaza

Nov 20th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. void CRemote::Output(LPCTSTR pszName)
  2. {
  3.  
  4.   ...
  5.   CHAR* pBytes = new CHAR[ nBytes ];
  6.   hFile.Read( pBytes, nBytes );
  7.   ...
  8.   if ( nBytes > 3 &&
  9.        pBytes[0] == 0xEF &&
  10.        pBytes[1] == 0xBB &&
  11.        pBytes[2] == 0xBF )
  12.   {
  13.     pBytes += 3;
  14.     nBytes -= 3;
  15.     bBOM = true;
  16.   }
  17.   ...
  18. }
  19.  
  20. This suspicious code was found in Shareaza project by PVS-Studio static code analyzer.
  21. Warning message is:
  22. V547 Expression 'pBytes [ 0 ] == 0xEF' is always false. The value range of signed char type: [-128, 127]. Shareaza remote.cpp 350
  23.  
  24. 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