ras: tweak max file check

better to do - 32 than + 32 otherwise we may overflow

oss-fuzz/13017
This commit is contained in:
Albert Astals Cid
2019-02-11 22:57:33 +01:00
parent aeec934839
commit d79c11d280

View File

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