mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-07-19 12:14:20 -04:00
ras: Protect against divide by zero
oss-fuzz/12905
This commit is contained in:
@ -111,6 +111,12 @@ static bool LoadRAS(QDataStream &s, const RasHeader &ras, QImage &img)
|
||||
}
|
||||
|
||||
const int bpp = ras.Depth / 8;
|
||||
if (ras.Height == 0) {
|
||||
return false;
|
||||
}
|
||||
if (bpp == 0) {
|
||||
return false;
|
||||
}
|
||||
if (ras.Length / ras.Height / bpp < ras.Width) {
|
||||
qWarning() << "LoadRAS() mistmatch between height and width" << ras.Width << ras.Height << ras.Length << ras.Depth;
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user