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

Unified Diff: src/core/SkMallocPixelRef.cpp

Issue 107003006: Fixing crash found by fuzzer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 7 years 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/SkMallocPixelRef.cpp
diff --git a/src/core/SkMallocPixelRef.cpp b/src/core/SkMallocPixelRef.cpp
index b65197fac852ae7e5dceb3bf4ed4764dc92cd087..927301b763c73b2ca74c7f36e7a9343e0e20e770 100644
--- a/src/core/SkMallocPixelRef.cpp
+++ b/src/core/SkMallocPixelRef.cpp
@@ -142,7 +142,7 @@ SkMallocPixelRef::SkMallocPixelRef(SkFlattenableReadBuffer& buffer)
, fOwnPixels(true)
{
fRB = buffer.read32();
- size_t size = this->info().getSafeSize(fRB);
+ size_t size = buffer.isValid() ? this->info().getSafeSize(fRB) : 0;
if (buffer.validateAvailable(size)) {
fStorage = sk_malloc_throw(size);
buffer.readByteArray(fStorage, size);
« 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