Fix off-by-one error in the TGA RLE decompressor

This commit is contained in:
numzero 2023-10-31 21:34:43 +03:00 committed by sfan5
parent eafc282efd
commit 85081d6fe0

View File

@ -46,7 +46,7 @@ u8 *CImageLoaderTGA::loadCompressedImage(io::IReadFile *file, const STGAHeader&
chunkheader++; // Add 1 To The Value To Get Total Number Of Raw Pixels
const u32 bytesToRead = bytesPerPixel * chunkheader;
if ( currentByte+bytesToRead < imageSize )
if ( currentByte+bytesToRead <= imageSize )
{
file->read(&data[currentByte], bytesToRead);
currentByte += bytesToRead;