mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
Add size check for large images.
This commit is contained in:
@@ -411,6 +411,11 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user