PVS-StudioWarnings

PVS-Studio warning V547 for Shareaza

Nov 18th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. inline void CXmlReader::CXmlInputStream::UnsafePutCharsBack(
  2.   const TCHAR* pChars, size_t nNumChars)
  3. {
  4.   if (nNumChars > 0)
  5.   {
  6.     for (size_t nCharPos = nNumChars - 1;
  7.          nCharPos >= 0;
  8.          --nCharPos)
  9.       UnsafePutCharBack(pChars[nCharPos]);
  10.   }
  11. }
  12.  
  13. Infinite loop.
  14.  
  15. This suspicious code was found in Shareaza project by PVS-Studio static code analyzer.
  16. Warning message is:
  17. V547 Expression 'nCharPos >= 0' is always true. Unsigned type value is always >= 0. BugTrap xmlreader.h 946
  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