Advertisement
PVS-StudioWarnings

PVS-Studio warning V547 for ReactOS

Nov 20th, 2014
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. static VOID
  2. DetectBiosDisks(....)
  3. {
  4.   UCHAR DiskCount, i;
  5.   ...
  6.   for (i = 0; ! Changed && i < 512; i++)
  7.   {
  8.     Changed = ((PUCHAR)DISKREADBUFFER)[i] != 0xcd;
  9.   }
  10.   ...
  11. }
  12.  
  13. An infinite loop will occur here if the first 255 bytes contain value 0xcd.
  14.  
  15.  
  16. This suspicious code was found in ReactOS project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V547 Expression 'i < 512' is always true. The value range of unsigned char type: [0, 255]. freeldr_common xboxhw.c 344
  19.  
  20. 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