From c47300b23cd5a368081f1243dfad4882bdc7c6b7 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 4b8cb4da2..bc8298fce 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;