ras: tweak max size that "fits" in a QVector

oss-fuzz/12951
This commit is contained in:
Albert Astals Cid
2019-02-07 22:14:22 +01:00
parent 039d7d8fbe
commit 4a8da73f0e

View File

@ -121,7 +121,8 @@ static bool LoadRAS(QDataStream &s, const RasHeader &ras, QImage &img)
qWarning() << "LoadRAS() mistmatch between height and width" << ras.Width << ras.Height << ras.Length << ras.Depth; qWarning() << "LoadRAS() mistmatch between height and width" << ras.Width << ras.Height << ras.Length << ras.Depth;
return false; return false;
} }
if (ras.Length > std::numeric_limits<int>::max()) { // QVector uses some extra space for stuff, hence the 32 here suggested by thiago
if (ras.Length + 32 > std::numeric_limits<int>::max()) {
qWarning() << "LoadRAS() unsupported image length in file header" << ras.Length; qWarning() << "LoadRAS() unsupported image length in file header" << ras.Length;
return false; return false;
} }