aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/SkMorphologyImageFilter.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-04 17:06:49 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-04 17:06:49 +0000
commitcd3b15ca6364a04b0eeeb4f89c7daa8aefe854c8 (patch)
treea8153f3f6fcd156fec3d8d46555c2d81c1e90b67 /src/effects/SkMorphologyImageFilter.cpp
parent2b7d4639901e03a43278dfec0b949bc4535b90e2 (diff)
Fixed bad bitmap size crashes
There were 2 issues : 1 ) If the size of an SkBitmap's underlying SkPixelRef's alocated memory is too small to fit the bitmap, then the deserialization will now check this and set an error appropriately. 2 ) If a device fails to allocate its pixels, the device will be deleted and NULL will be returned to avoid attempting to draw on a bad device. BUG= R=senorblanco@chromium.org, reed@google.com, sugoi@google.com, halcanary@google.com, mtklein@google.com Author: sugoi@chromium.org Review URL: https://codereview.chromium.org/92793002 git-svn-id: http://skia.googlecode.com/svn/trunk@12484 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/effects/SkMorphologyImageFilter.cpp')
-rw-r--r--src/effects/SkMorphologyImageFilter.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 3f2f98557a..0d00c359d8 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -188,6 +188,9 @@ bool SkErodeImageFilter::onFilterImage(Proxy* proxy,
dst->setConfig(src.config(), bounds.width(), bounds.height());
dst->allocPixels();
+ if (!dst->getPixels()) {
+ return false;
+ }
int width = radius().width();
int height = radius().height();
@@ -247,6 +250,9 @@ bool SkDilateImageFilter::onFilterImage(Proxy* proxy,
dst->setConfig(src.config(), bounds.width(), bounds.height());
dst->allocPixels();
+ if (!dst->getPixels()) {
+ return false;
+ }
int width = radius().width();
int height = radius().height();