check for crazy bounds from fuzzer

Bug: skia:7471
Change-Id: I1d6e2059a0c4f2b705d3b0fe2694f17b68c3ae5c
Reviewed-on: https://skia-review.googlesource.com/97122
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2018-01-19 12:57:01 -05:00 committed by Skia Commit-Bot
parent 07320e46c0
commit 9cec1bc1a7
2 changed files with 7 additions and 0 deletions

View File

@ -1289,6 +1289,7 @@ static void fuzz_canvas(Fuzz* fuzz, SkCanvas* canvas, int depth = 9) {
canvas->drawOval(r, paint);
break;
}
case 28: break; // must have deleted this some time earlier
case 29: {
fuzz_paint(fuzz, &paint, depth - 1);
SkRRect rr;

View File

@ -953,6 +953,9 @@ bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveLayerFlags saveLayerFlag
if (imageFilter) {
clipBounds = imageFilter->filterBounds(clipBounds, ctm);
if (clipBounds.isEmpty()) {
return false;
}
if (bounds && !imageFilter->canComputeFastBounds()) {
bounds = nullptr;
}
@ -1395,6 +1398,9 @@ void SkCanvas::resetMatrix() {
//////////////////////////////////////////////////////////////////////////////
void SkCanvas::clipRect(const SkRect& rect, SkClipOp op, bool doAA) {
if (!rect.isFinite()) {
return;
}
this->checkForDeferredSave();
ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle;
this->onClipRect(rect, op, edgeStyle);