mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1349595 - Check GMP i420 frame size computations. r=cpearce
MozReview-Commit-ID: 9HdCbOKah28
This commit is contained in:
parent
4662c498be
commit
b7520a7dec
@ -5,6 +5,7 @@
|
||||
|
||||
#include "GMPVideoi420FrameImpl.h"
|
||||
#include "mozilla/gmp/GMPTypes.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gmp {
|
||||
@ -93,9 +94,11 @@ GMPVideoi420FrameImpl::CheckDimensions(int32_t aWidth, int32_t aHeight,
|
||||
int32_t aStride_y, int32_t aStride_u, int32_t aStride_v)
|
||||
{
|
||||
int32_t half_width = (aWidth + 1) / 2;
|
||||
if (aWidth < 1 || aHeight < 1 || aStride_y < aWidth ||
|
||||
aStride_u < half_width ||
|
||||
aStride_v < half_width) {
|
||||
if (aWidth < 1 || aHeight < 1 ||
|
||||
aStride_y < aWidth || aStride_u < half_width || aStride_v < half_width ||
|
||||
!(CheckedInt<int32_t>(aHeight) * aStride_y
|
||||
+ ((CheckedInt<int32_t>(aHeight) + 1) / 2)
|
||||
* (CheckedInt<int32_t>(aStride_u) + aStride_v)).isValid()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user