Bug 1348237 part 1 - prevent overflow in BlankVideoDataCreater; r=jwwang

MozReview-Commit-ID: D5BZIfpZjD3

--HG--
extra : rebase_source : 263394e6057415551e9eb36bc3c74daa33a93c30
This commit is contained in:
Kaku Kuo 2017-03-17 16:20:08 +08:00
parent a01488052d
commit c819daf588

View File

@ -37,7 +37,12 @@ public:
// with a U and V plane that are half the size of the Y plane, i.e 8 bit,
// 2x2 subsampled. Have the data pointer of each frame point to the
// first plane, they'll always be zero'd memory anyway.
auto frame = MakeUniqueFallible<uint8_t[]>(mFrameWidth * mFrameHeight);
const CheckedUint32 size = CheckedUint32(mFrameWidth) * mFrameHeight;
if (!size.isValid()) {
// Overflow happened.
return nullptr;
}
auto frame = MakeUniqueFallible<uint8_t[]>(size.value());
if (!frame) {
return nullptr;
}