Advertisement
PVS-StudioWarnings

PVS-Studio warning V547 for Miranda IM

Nov 20th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. void Append( PCXSTR pszSrc, int nLength )
  2. {
  3.   ...
  4.   UINT nOldLength = GetLength();
  5.   if (nOldLength < 0)
  6.   {
  7.     // protects from underflow
  8.     nOldLength = 0;
  9.   }
  10.   ...
  11. }
  12.  
  13. This suspicious code was found in Miranda IM project by PVS-Studio static code analyzer.
  14. Warning message is:
  15. V547 Expression 'nOldLength < 0' is always false. Unsigned type value is never < 0. IRC mstring.h 229
  16.  
  17. 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
Advertisement