mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-05-28 00:30:23 -04:00
ras: Protect against divide by zero
oss-fuzz/12905
This commit is contained in:
parent
bad90cea4b
commit
b072484dbb
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user