Fixed checking buffer overflow while loading RLE-compressed TARGA image.

Output data length (stored in 'index' variable) can be <= image buffer size so an error occurs if it exceeds this value.

Closes #14672.
This commit is contained in:
fx 2016-01-30 23:48:59 +01:00 committed by Artur Wieczorek
parent bc8293a9e5
commit 53db09d0e5

View File

@ -130,7 +130,7 @@ int DecodeRLE(unsigned char* imageData, unsigned long imageSize,
index += current * pixelSize;
if (index >= imageSize)
if (index > imageSize)
{
return wxTGA_IOERR;
}
@ -155,7 +155,7 @@ int DecodeRLE(unsigned char* imageData, unsigned long imageSize,
index += length;
if (index >= imageSize)
if (index > imageSize)
{
return wxTGA_IOERR;
}