mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-06-03 00:58:15 -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;
|
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) {
|
if (ras.Length / ras.Height / bpp < ras.Width) {
|
||||||
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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user