mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-06-03 17:08:08 -04:00
ras: protect the palette QVector too
oss-fuzz/13068
This commit is contained in:
parent
d79c11d280
commit
156bac5e54
@ -102,6 +102,13 @@ static bool IsSupported(const RasHeader &head)
|
||||
static bool LoadRAS(QDataStream &s, const RasHeader &ras, QImage &img)
|
||||
{
|
||||
s.device()->seek(RasHeader::SIZE);
|
||||
|
||||
// QVector uses some extra space for stuff, hence the 32 here suggested by thiago
|
||||
if (ras.ColorMapLength > std::numeric_limits<int>::max() - 32) {
|
||||
qWarning() << "LoadRAS() unsupported image color map length in file header" << ras.ColorMapLength;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Read palette if needed.
|
||||
QVector<quint8> palette(ras.ColorMapLength);
|
||||
if (ras.ColorMapType == 1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user