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

Unified Diff: src/core/SkWriteBuffer.cpp

Issue 1308273011: Handle zero-length encoded images gracefully during deserialization (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: generator comments Created 5 years, 3 months 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
Index: src/core/SkWriteBuffer.cpp
diff --git a/src/core/SkWriteBuffer.cpp b/src/core/SkWriteBuffer.cpp
index ac3d678dbc011a70b9c38cdd91ce4199f633750c..1dfe0b3972c62b6b8e68cc6f6d92dc8782935b97 100644
--- a/src/core/SkWriteBuffer.cpp
+++ b/src/core/SkWriteBuffer.cpp
@@ -223,7 +223,7 @@ void SkWriteBuffer::writeImage(const SkImage* image) {
this->writeInt(image->height());
SkAutoTUnref<SkData> encoded(image->encode(this->getPixelSerializer()));
- if (encoded) {
+ if (encoded && encoded->size() > 0) {
write_encoded_bitmap(this, encoded, SkIPoint::Make(0, 0));
return;
}

Powered by Google App Engine
This is Rietveld 408576698