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:
parent
bc8293a9e5
commit
53db09d0e5
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user