From 85081d6fe0c422cf47f74714ee25562715528aa2 Mon Sep 17 00:00:00 2001 From: numzero Date: Tue, 31 Oct 2023 21:34:43 +0300 Subject: [PATCH] Fix off-by-one error in the TGA RLE decompressor --- source/Irrlicht/CImageLoaderTGA.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Irrlicht/CImageLoaderTGA.cpp b/source/Irrlicht/CImageLoaderTGA.cpp index 4b8cb4da..bc8298fc 100644 --- a/source/Irrlicht/CImageLoaderTGA.cpp +++ b/source/Irrlicht/CImageLoaderTGA.cpp @@ -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;