require finite blob bounds

inspired by https://fuzzer.skia.org/category/image_filter_deserialize/file/aW5jbHVkZS9jb3JlL1NrUGFpbnQuaA==?

Bug: skia:
Change-Id: I490585b9fdc0b4b29565849478b97ed7f5057ca1
Reviewed-on: https://skia-review.googlesource.com/98800
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2018-01-23 13:06:12 -05:00 committed by Skia Commit-Bot
parent 01b476a028
commit 74d6e113a5

View File

@ -50,6 +50,7 @@
#include "SkVertices.h"
#define RETURN_ON_NULL(ptr) do { if (nullptr == (ptr)) return; } while (0)
#define RETURN_ON_FALSE(pred) do { if (!(pred)) return; } while (0)
class SkNoPixelsDevice : public SkBaseDevice {
public:
@ -2610,6 +2611,7 @@ void SkCanvas::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) {
TRACE_EVENT0("skia", TRACE_FUNC);
RETURN_ON_NULL(blob);
RETURN_ON_FALSE(blob->bounds().makeOffset(x, y).isFinite());
this->onDrawTextBlob(blob, x, y, paint);
}