Check for nullptrs when fuzzing region_deserialize

Bug: oss-fuzz:5629
Change-Id: I1129a6a9a68c69e07ab63e2e2be1c00cf0581962
Reviewed-on: https://skia-review.googlesource.com/102482
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
Kevin Lubick 2018-02-01 09:45:11 -05:00 committed by Skia Commit-Bot
parent 08895c4814
commit a71b8d17e8

View File

@ -24,7 +24,11 @@ bool FuzzRegionDeserialize(sk_sp<SkData> bytes) {
} else {
region.contains(1,1);
}
auto s = SkSurface::MakeRasterN32Premul(1024, 1024);
auto s = SkSurface::MakeRasterN32Premul(128, 128);
if (!s) {
// May return nullptr in memory-constrained fuzzing environments
return false;
}
s->getCanvas()->drawRegion(region, SkPaint());
SkDEBUGCODE(region.validate());
return true;