Advertisement
PVS-StudioWarnings

PVS-Studio warning V557 for irrlicht

Nov 24th, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. struct SPCXHeader {
  2.   ...
  3.   u8   Palette[48];
  4.   u8   Reserved;
  5.   u8   Planes;
  6.   u16  BytesPerLine;
  7.   ...
  8. }
  9.  
  10. IImage* CImageLoaderPCX::loadImage(io::IReadFile* file) const
  11. {
  12.   ...
  13.   for( s32 i=0; i<256; i++ )
  14.   {
  15.     paletteData[i] = (header.Palette[i*3+0] << 16) |
  16.      (header.Palette[i*3+1] << 8) |
  17.      (header.Palette[i*3+2]);
  18.   }
  19.   ...
  20. }
  21.  
  22. This suspicious code was found in irrlicht project by PVS-Studio static code analyzer.
  23. Warning message is:
  24. V557 Array overrun is possible. The value of 'i * 3 + 0' index could reach 765.  Irrlicht  cimageloaderpcx.cpp  113
  25.  
  26. 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