Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1294677 - Check for large image sizes. r=jrmuizel
Browse files Browse the repository at this point in the history
  • Loading branch information
msreckovic committed Aug 25, 2016
1 parent e9edffe commit 7bd1c6a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dom/base/ImageEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7bd1c6a

Please sign in to comment.