Bug 1131808 - Avoid trying to allocate a buffer for 0 sized YCbCr images. r=nical, a=lmandel
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 12 Feb 2015 11:23:56 +1300
changeset 250363 05df69e4ada6
parent 250362 09ac7b7f011a
child 250364 45cc75aa62d9
push id4560
push userryanvm@gmail.com
push date2015-03-12 14:27 +0000
treeherdermozilla-beta@05df69e4ada6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical, lmandel
bugs1131808
milestone37.0
Bug 1131808 - Avoid trying to allocate a buffer for 0 sized YCbCr images. r=nical, a=lmandel
gfx/layers/client/TextureClient.cpp
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -855,17 +855,17 @@ bool
 BufferTextureClient::AllocateForYCbCr(gfx::IntSize aYSize,
                                       gfx::IntSize aCbCrSize,
                                       StereoMode aStereoMode)
 {
   MOZ_ASSERT(IsValid());
 
   size_t bufSize = YCbCrImageDataSerializer::ComputeMinBufferSize(aYSize,
                                                                   aCbCrSize);
-  if (!Allocate(bufSize)) {
+  if (!bufSize || !Allocate(bufSize)) {
     return false;
   }
   YCbCrImageDataSerializer serializer(GetBuffer(), GetBufferSize());
   serializer.InitializeBufferInfo(aYSize,
                                   aCbCrSize,
                                   aStereoMode);
   mSize = aYSize;
   return true;