Index: src/core/SkBitmap.cpp |
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp |
index a40f61af35f333bb73386f459728c2bf60a098c7..651152e703bd5c2e0bf9c31b6f97f9d33abba532 100644 |
--- a/src/core/SkBitmap.cpp |
+++ b/src/core/SkBitmap.cpp |
@@ -1201,6 +1201,11 @@ bool SkBitmap::ReadRawPixels(SkReadBuffer* buffer, SkBitmap* bitmap) { |
SkImageInfo info; |
info.unflatten(*buffer); |
+ // If there was an error reading "info", don't use it to compute minRowBytes() |
+ if (!buffer->validate(true)) { |
+ return false; |
+ } |
+ |
const size_t ramRB = info.minRowBytes(); |
const int height = info.height(); |
const size_t snugSize = snugRB * height; |