From cf078d87e6e5d5948011bf1d12add7ecf9eddce2 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Thu, 28 Jan 2016 17:30:01 -0600 Subject: [PATCH] Bug 1224979. Check if we compute usable filters for the downscaler, and if not put the downscaler in error state so it's not used. r=edwin --- image/Downscaler.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/image/Downscaler.cpp b/image/Downscaler.cpp index f8578ab0b0a9..b6ec349c123b 100644 --- a/image/Downscaler.cpp +++ b/image/Downscaler.cpp @@ -106,11 +106,21 @@ Downscaler::BeginFrame(const nsIntSize& aOriginalSize, 0, mTargetSize.width, mXFilter.get()); + if (mXFilter->max_filter() <= 0 || mXFilter->num_values() != mTargetSize.width) { + NS_WARNING("Failed to compute filters for image downscaling"); + return NS_ERROR_OUT_OF_MEMORY; + } + skia::resize::ComputeFilters(resizeMethod, mOriginalSize.height, mTargetSize.height, 0, mTargetSize.height, mYFilter.get()); + if (mYFilter->max_filter() <= 0 || mYFilter->num_values() != mTargetSize.height) { + NS_WARNING("Failed to compute filters for image downscaling"); + return NS_ERROR_OUT_OF_MEMORY; + } + // Allocate the buffer, which contains scanlines of the original image. // pad by 15 to handle overreads by the simd code size_t bufferLen = mOriginalSize.width * sizeof(uint32_t) + 15;