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); |