Advertisement
PVS-StudioWarnings

PVS-Studio warning V547 for ReactOS

Nov 24th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #define DISKREADBUFFER_SIZE HEX(10000)
  2.  
  3. typedef unsigned short USHORT, *PUSHORT;
  4.  
  5. static VOID DetectBiosDisks(....)
  6. {
  7.   USHORT i;
  8.   ....
  9.   Changed = FALSE;
  10.   for (i = 0; ! Changed && i < DISKREADBUFFER_SIZE; i++)
  11.   {
  12.     Changed = ((PUCHAR)DISKREADBUFFER)[i] != 0xcd;
  13.   }
  14.   ....
  15. }
  16.  
  17. This suspicious code was found in ReactOS project by PVS-Studio static code analyzer.
  18. Warning message is:
  19. V547 Expression 'i < 0x10000' is always true. The value range of unsigned short type: [0, 65535]. xboxhw.c 358
  20.  
  21. 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