Bug 1385409 - Ignore ICO resource entries which contain little or no data. r=tnikkel

This commit is contained in:
Andrew Osmond 2017-08-01 07:21:14 -04:00
parent 833d108847
commit 9bc359ef2c

View File

@ -163,10 +163,15 @@ nsICODecoder::ReadDirEntry(const char* aData)
e.mBytesInRes = LittleEndian::readUint32(aData + 8);
e.mImageOffset = offset;
e.mSize = IntSize(e.mWidth, e.mHeight);
if (e.mWidth == 0 || e.mHeight == 0) {
mUnsizedDirEntries.AppendElement(e);
} else {
mDirEntries.AppendElement(e);
// Only accept entries with sufficient resource data to actually contain
// some image data.
if (e.mBytesInRes > BITMAPINFOSIZE) {
if (e.mWidth == 0 || e.mHeight == 0) {
mUnsizedDirEntries.AppendElement(e);
} else {
mDirEntries.AppendElement(e);
}
}
}