diff options
author | 2016-03-21 11:25:42 -0700 | |
---|---|---|
committer | 2016-03-21 11:25:42 -0700 | |
commit | fa4c20e728c2b25f7b1a7d858adc8156005ec229 (patch) | |
tree | 02694093634220e206b353f3983267f7c316a872 /src/core/SkBitmapScaler.cpp | |
parent | d9dd581566d5a707cf9f5f0f0901e968c95a1104 (diff) |
exit computeFilters if filter width is zero
The fuzzer associated with this bug triggered an assert
when building the resize filter. I can't tell if there
is a more fundemental bug here or not.
Checking for a zero-sized filter fixes the fuzzer.
R=fmalita@chromium.org
BUG=595856
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1810333002
Review URL: https://codereview.chromium.org/1810333002
Diffstat (limited to 'src/core/SkBitmapScaler.cpp')
-rw-r--r-- | src/core/SkBitmapScaler.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/SkBitmapScaler.cpp b/src/core/SkBitmapScaler.cpp index c69ac2a950..e3face8c75 100644 --- a/src/core/SkBitmapScaler.cpp +++ b/src/core/SkBitmapScaler.cpp @@ -167,7 +167,10 @@ void SkResizeFilter::computeFilters(int srcSize, // is at (2.5, 2.5). float destFilterDist = (srcBegin + 0.5f - srcPixel) * clampedScale; int filterCount = SkScalarTruncToInt(srcEnd - srcBegin) + 1; - SkASSERT(filterCount > 0); + if (filterCount <= 0) { + // true when srcSize is equal to srcPixel - srcSupport; this may be a bug + return; + } filterValuesArray.reset(filterCount); float filterSum = fBitmapFilter->evaluate_n(destFilterDist, clampedScale, filterCount, filterValuesArray.begin()); |