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
This commit is contained in:
caryclark 2016-03-21 11:25:42 -07:00 committed by Commit bot
parent d9dd581566
commit fa4c20e728

View File

@ -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());