Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Unified Diff: src/core/SkBitmap.cpp

Issue 162943003: Fixed clusterfuzz found crash (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added early return Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmap.cpp
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 96d683c0e2592765351bcf5e9912085b660093a6..3418fad7f197e1014fe63243a1571ee083178363 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -1566,11 +1566,13 @@ void SkBitmap::unflatten(SkReadBuffer& buffer) {
SkImageInfo info;
info.unflatten(buffer);
size_t rowBytes = buffer.readInt();
- buffer.validate((info.width() >= 0) && (info.height() >= 0) &&
- SkColorTypeIsValid(info.fColorType) &&
- SkAlphaTypeIsValid(info.fAlphaType) &&
- validate_alphaType(info.fColorType, info.fAlphaType) &&
- info.validRowBytes(rowBytes));
+ if (!buffer.validate((info.width() >= 0) && (info.height() >= 0) &&
+ SkColorTypeIsValid(info.fColorType) &&
+ SkAlphaTypeIsValid(info.fAlphaType) &&
+ validate_alphaType(info.fColorType, info.fAlphaType) &&
+ info.validRowBytes(rowBytes))) {
+ return;
+ }
bool configIsValid = this->setConfig(info, rowBytes);
buffer.validate(configIsValid);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698