Bug 906601 - filter processing memory allocation should be fallible. r=jwatt
authorRobert Longson <longsonr@gmail.com>
Wed, 04 Sep 2013 22:14:10 +0100
changeset 158503 6537b89b9063bfc48dec8fbb9bad2af11d0d6e98
parent 158502 1e63861a73d93b45284379c5fe1bcb279aa2e995
child 158504 4db34d255ed0070b9f8a7eacc67a1e35b0c78aa9
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs906601
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 906601 - filter processing memory allocation should be fallible. r=jwatt
content/svg/content/src/SVGFEConvolveMatrixElement.cpp
content/svg/content/src/SVGFEGaussianBlurElement.cpp
--- a/content/svg/content/src/SVGFEConvolveMatrixElement.cpp
+++ b/content/svg/content/src/SVGFEConvolveMatrixElement.cpp
@@ -301,17 +301,18 @@ SVGFEConvolveMatrixElement::Filter(nsSVG
       return NS_ERROR_FAILURE;
   } else {
     targetY = orderY / 2;
   }
 
   if (orderX > NS_SVG_OFFSCREEN_MAX_DIMENSION ||
       orderY > NS_SVG_OFFSCREEN_MAX_DIMENSION)
     return NS_ERROR_FAILURE;
-  nsAutoArrayPtr<float> kernel(new float[orderX * orderY]);
+  const fallible_t fallible = fallible_t();
+  nsAutoArrayPtr<float> kernel(new (fallible) float[orderX * orderY]);
   if (!kernel)
     return NS_ERROR_FAILURE;
   for (uint32_t i = 0; i < kmLength; i++) {
     kernel[kmLength - 1 - i] = kernelMatrix[i];
   }
 
   float divisor;
   if (mNumberAttributes[DIVISOR].IsExplicitlySet()) {
--- a/content/svg/content/src/SVGFEGaussianBlurElement.cpp
+++ b/content/svg/content/src/SVGFEGaussianBlurElement.cpp
@@ -231,17 +231,18 @@ void
 SVGFEGaussianBlurElement::GaussianBlur(const Image* aSource,
                                        const Image* aTarget,
                                        const nsIntRect& aDataRect,
                                        uint32_t aDX, uint32_t aDY)
 {
   NS_ASSERTION(nsIntRect(0, 0, aTarget->mImage->Width(), aTarget->mImage->Height()).Contains(aDataRect),
                "aDataRect out of bounds");
 
-  nsAutoArrayPtr<uint8_t> tmp(new uint8_t[aTarget->mImage->GetDataSize()]);
+  const fallible_t fallible = fallible_t();
+  nsAutoArrayPtr<uint8_t> tmp(new (fallible) uint8_t[aTarget->mImage->GetDataSize()]);
   if (!tmp)
     return;
   memset(tmp, 0, aTarget->mImage->GetDataSize());
 
   bool alphaOnly = AreAllColorChannelsZero(aTarget);
 
   const uint8_t* sourceData = aSource->mImage->Data();
   uint8_t* targetData = aTarget->mImage->Data();