diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index 3c88b50d03..be363c5c63 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -542,6 +542,9 @@ bool SkBitmap::extractAlpha(SkBitmap* dst, const SkPaint* paint, SkMatrix identity; SkMask srcM, dstM; + if (this->width() == 0 || this->height() == 0) { + return false; + } srcM.fBounds.set(0, 0, this->width(), this->height()); srcM.fRowBytes = SkAlign4(this->width()); srcM.fFormat = SkMask::kA8_Format; diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp index d77989ebab..36723f6fa6 100644 --- a/tests/BlurTest.cpp +++ b/tests/BlurTest.cpp @@ -732,3 +732,13 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(BlurMaskBiggerThanDest, reporter, ctxInfo) { REPORTER_ASSERT(reporter, SkColorGetB(readback.getColor(15, 15)) == 0); REPORTER_ASSERT(reporter, readback.getColor(31, 31) == SK_ColorBLACK); } + +DEF_TEST(zero_blur, reporter) { + SkBitmap alpha, bitmap; + + SkPaint paint; + paint.setMaskFilter(SkMaskFilter::MakeBlur(kOuter_SkBlurStyle, 3)); + SkIPoint offset; + bitmap.extractAlpha(&alpha, &paint, nullptr, &offset); +} +