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:
@@ -130,7 +130,7 @@ int DecodeRLE(unsigned char* imageData, unsigned long imageSize,
|
|||||||
|
|
||||||
index += current * pixelSize;
|
index += current * pixelSize;
|
||||||
|
|
||||||
if (index >= imageSize)
|
if (index > imageSize)
|
||||||
{
|
{
|
||||||
return wxTGA_IOERR;
|
return wxTGA_IOERR;
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ int DecodeRLE(unsigned char* imageData, unsigned long imageSize,
|
|||||||
|
|
||||||
index += length;
|
index += length;
|
||||||
|
|
||||||
if (index >= imageSize)
|
if (index > imageSize)
|
||||||
{
|
{
|
||||||
return wxTGA_IOERR;
|
return wxTGA_IOERR;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user