diff options
author | reed <reed@google.com> | 2014-11-12 09:25:25 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-12 09:25:25 -0800 |
commit | ac6a2f964ee9821df6a4a8f3c46796322a4c37b8 (patch) | |
tree | 1ad3c2f0fad361dc2285d388b77fdf591b029089 /src/core/SkReadBuffer.cpp | |
parent | 257bf0f6f7b0c4f55e6eb9e0fa1290cd5c2fcf9f (diff) |
detect bad bitmaps during deserialization
BUG=skia:3117
Review URL: https://codereview.chromium.org/718103002
Diffstat (limited to 'src/core/SkReadBuffer.cpp')
-rw-r--r-- | src/core/SkReadBuffer.cpp | 5 |
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)) { |