summaryrefslogtreecommitdiffstats
path: root/gfx/layers
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-02-06 00:48:16 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-02-06 00:48:16 +0100
commit7c9b585349c985df0cf6ace83da5dadba8b5c677 (patch)
treef22acdd5995354fa704855a57cc09d54392d902e /gfx/layers
parente8417003899a4ec9274815be30352c1328fc32e9 (diff)
parenta9b44dbcb33cd98b163f8a21223643f2cf3829cd (diff)
downloadUXP-7c9b585349c985df0cf6ace83da5dadba8b5c677.tar
UXP-7c9b585349c985df0cf6ace83da5dadba8b5c677.tar.gz
UXP-7c9b585349c985df0cf6ace83da5dadba8b5c677.tar.lz
UXP-7c9b585349c985df0cf6ace83da5dadba8b5c677.tar.xz
UXP-7c9b585349c985df0cf6ace83da5dadba8b5c677.zip
Merge branch 'ported-upstream'
Diffstat (limited to 'gfx/layers')
-rw-r--r--gfx/layers/basic/BasicImages.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/gfx/layers/basic/BasicImages.cpp b/gfx/layers/basic/BasicImages.cpp
index ed9447207..fc1be6e9a 100644
--- a/gfx/layers/basic/BasicImages.cpp
+++ b/gfx/layers/basic/BasicImages.cpp
@@ -11,6 +11,7 @@
#include "gfxASurface.h" // for gfxASurface, etc
#include "gfxPlatform.h" // for gfxPlatform, gfxImageFormat
#include "gfxUtils.h" // for gfxUtils
+#include "mozilla/CheckedInt.h"
#include "mozilla/mozalloc.h" // for operator delete[], etc
#include "mozilla/RefPtr.h"
#include "mozilla/UniquePtr.h"
@@ -111,7 +112,13 @@ BasicPlanarYCbCrImage::CopyData(const Data& aData)
gfxImageFormat iFormat = gfx::SurfaceFormatToImageFormat(format);
mStride = gfxASurface::FormatStrideForWidth(iFormat, size.width);
- mDecodedBuffer = AllocateBuffer(size.height * mStride);
+ mozilla::CheckedInt32 requiredBytes =
+ mozilla::CheckedInt32(size.height) * mozilla::CheckedInt32(mStride);
+ if (!requiredBytes.isValid()) {
+ // invalid size
+ return false;
+ }
+ mDecodedBuffer = AllocateBuffer(requiredBytes.value());
if (!mDecodedBuffer) {
// out of memory
return false;