PVS-StudioWarnings

PVS-Studio warning V547 for Shareaza

Nov 18th, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. size_t UTF16BeDecodeChar(BYTE* pBytes, size_t nNumBytes,
  2.                          TCHAR arrChar[2], size_t& nCharSize)
  3. {
  4.   if (UTF16BeToLeChar(pBytes, nNumBytes) < 0)
  5.   {
  6.     nCharSize = MAXSIZE_T;
  7.     return 0;
  8.   }
  9.   return UTF16LeDecodeChar(pBytes, nNumBytes,
  10.                            arrChar, nCharSize);
  11. }
  12.  
  13. In case of an error, the UTF16BeToLeChar() function returns MAXSIZE_T. This case will be handled incorrectly.
  14.  
  15. This suspicious code was found in Shareaza project by PVS-Studio static code analyzer.
  16. Warning message is:
  17. V547 Expression is always false. Unsigned type value is never < 0. BugTrap encoding.cpp 425
  18.  
  19. 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