SkImageInfos that were made invalid weren't being caught
Messing with the size of a SAVE record wasn't being caught
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=
2104973003
Review-Url: https://codereview.chromium.org/
2104973003
SkImageInfo info;
info.unflatten(*buffer);
- // If there was an error reading "info", don't use it to compute minRowBytes()
- if (!buffer->validate(true)) {
+ // If there was an error reading "info" or if it is bogus,
+ // don't use it to compute minRowBytes()
+ if (!buffer->validate(SkColorTypeValidateAlphaType(info.colorType(),
+ info.alphaType()))) {
return false;
}
case SAVE:
// SKPs with version < 29 also store a SaveFlags param.
if (size > 4) {
- SkASSERT(8 == size);
- reader->readInt();
+ if (reader->validate(8 == size)) {
+ reader->readInt();
+ }
}
canvas->save();
break;