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

Unified Diff: src/core/SkReadBuffer.cpp

Issue 718103002: detect bad bitmaps during deserialization (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: return true (but empty) if we just didn't recognize the codec type Created 6 years, 1 month 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
« src/core/SkPictureData.cpp ('K') | « src/core/SkPictureData.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkReadBuffer.cpp
diff --git a/src/core/SkReadBuffer.cpp b/src/core/SkReadBuffer.cpp
index 43587862b94f8e64f814c36704274ab31411ec62..ca65f606d0f3d9a16b8a6ec55ce407777519eb23 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.");
scroggo 2014/11/12 18:24:48 I think this error message is well out of date.
reed1 2014/11/12 19:25:19 Yea, esp. the RED part. I will update.
+ // 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
scroggo 2014/11/12 18:24:48 force* ?
reed1 2014/11/12 19:25:19 Acknowledged.
+ // 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)) {
« src/core/SkPictureData.cpp ('K') | « src/core/SkPictureData.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698