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

Unified Diff: src/core/SkBitmap.cpp

Issue 306033003: Fixing a clusterfuzz found issue (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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 e5cc0d7fcd7b627bcecf57d4bde26c0567c2ba80..522dfb1ebb0bf5677600de315b5949b5f7b52d93 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -1308,7 +1308,9 @@ bool SkBitmap::ReadRawPixels(SkReadBuffer* buffer, SkBitmap* bitmap) {
const int height = info.height();
const size_t snugSize = snugRB * height;
const size_t ramSize = ramRB * height;
- SkASSERT(snugSize <= ramSize);
+ if (!buffer->validate(snugSize <= ramSize)) {
+ return false;
+ }
char* dst = (char*)sk_malloc_throw(ramSize);
buffer->readByteArray(dst, snugSize);
« 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