mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-06-03 17:08:08 -04:00
tga: don't try to read more than max_palette_size into palette
This commit is contained in:
parent
96b1d7e7bc
commit
1a9b5d6cb6
@ -206,6 +206,9 @@ static bool LoadTGA(QDataStream &s, const TgaHeader &tga, QImage &img)
|
|||||||
if (info.pal) {
|
if (info.pal) {
|
||||||
// @todo Support palettes in other formats!
|
// @todo Support palettes in other formats!
|
||||||
const int palette_size = 3 * tga.colormap_length;
|
const int palette_size = 3 * tga.colormap_length;
|
||||||
|
if (palette_size > max_palette_size) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const int dataRead = s.readRawData(palette, palette_size);
|
const int dataRead = s.readRawData(palette, palette_size);
|
||||||
if (dataRead < 0) {
|
if (dataRead < 0) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user