Bug 1294677 - Check for large image sizes. r=jrmuizel

--HG--
extra : rebase_source : 7ac19edde4612d5b1378fb88ea5fb1ebed3a8987
This commit is contained in:
Milan Sreckovic 2016-08-24 22:14:02 -04:00
Родитель 3208b6ac42
Коммит abd197b0f4
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -436,6 +436,12 @@ ImageEncoder::ExtractDataInternal(const nsAString& aType,
imgStream = do_QueryInterface(aEncoder);
}
} else {
CheckedInt32 requiredBytes = CheckedInt32(aSize.width) * CheckedInt32(aSize.height) * 4;
if (MOZ_UNLIKELY(!requiredBytes.isValid())) {
return NS_ERROR_INVALID_ARG;
}
// no context, so we have to encode an empty image
// note that if we didn't have a current context, the spec says we're
// supposed to just return transparent black pixels of the canvas