aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkReadBuffer.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-11-12 09:25:25 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-12 09:25:25 -0800
commitac6a2f964ee9821df6a4a8f3c46796322a4c37b8 (patch)
tree1ad3c2f0fad361dc2285d388b77fdf591b029089 /src/core/SkReadBuffer.cpp
parent257bf0f6f7b0c4f55e6eb9e0fa1290cd5c2fcf9f (diff)
detect bad bitmaps during deserialization
Diffstat (limited to 'src/core/SkReadBuffer.cpp')
-rw-r--r--src/core/SkReadBuffer.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/SkReadBuffer.cpp b/src/core/SkReadBuffer.cpp
index 43587862b9..ca65f606d0 100644
--- a/src/core/SkReadBuffer.cpp
+++ b/src/core/SkReadBuffer.cpp
@@ -260,6 +260,11 @@ bool SkReadBuffer::readBitmap(SkBitmap* bitmap) {
// not having a decoder.
SkErrorInternals::SetError(kParseError_SkError,
"Could not decode bitmap. Resulting bitmap will be red.");
+ // Even though we weren't able to decode the pixels, the readbuffer should still be
+ // intact, so we return true with an empty bitmap, so we don't for an abort of the
+ // larger deserialize.
+ bitmap->setInfo(SkImageInfo::MakeUnknown(width, height));
+ return true;
} else {
// A size of zero means the SkBitmap was simply flattened.
if (this->isVersionLT(kNoMoreBitmapFlatten_Version)) {