зеркало из https://github.com/mozilla/pjs.git
Bug 701259 - Restrict BasicPlanarYCbCrImage scaling destination size. r=roc
This commit is contained in:
Родитель
5b53859d58
Коммит
c5aabd8c01
|
@ -145,8 +145,9 @@ void
|
||||||
BasicPlanarYCbCrImage::SetData(const Data& aData)
|
BasicPlanarYCbCrImage::SetData(const Data& aData)
|
||||||
{
|
{
|
||||||
// Do some sanity checks to prevent integer overflow
|
// Do some sanity checks to prevent integer overflow
|
||||||
if (aData.mYSize.width > 16384 || aData.mYSize.height > 16384) {
|
if (aData.mYSize.width > PlanarYCbCrImage::MAX_DIMENSION ||
|
||||||
NS_ERROR("Illegal width or height");
|
aData.mYSize.height > PlanarYCbCrImage::MAX_DIMENSION) {
|
||||||
|
NS_ERROR("Illegal image source width or height");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,6 +160,11 @@ BasicPlanarYCbCrImage::SetData(const Data& aData)
|
||||||
|
|
||||||
gfxIntSize size(mScaleHint);
|
gfxIntSize size(mScaleHint);
|
||||||
gfxUtils::GetYCbCrToRGBDestFormatAndSize(aData, format, size);
|
gfxUtils::GetYCbCrToRGBDestFormatAndSize(aData, format, size);
|
||||||
|
if (size.width > PlanarYCbCrImage::MAX_DIMENSION ||
|
||||||
|
size.height > PlanarYCbCrImage::MAX_DIMENSION) {
|
||||||
|
NS_ERROR("Illegal image dest width or height");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mStride = gfxASurface::FormatStrideForWidth(format, size.width);
|
mStride = gfxASurface::FormatStrideForWidth(format, size.width);
|
||||||
mBuffer = AllocateBuffer(size.height * mStride);
|
mBuffer = AllocateBuffer(size.height * mStride);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче