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

Unified Diff: Source/platform/image-encoders/skia/PNGImageEncoder.cpp

Issue 1212333005: Add a bitmap width and height size check to the PNG encoder (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/image-encoders/skia/PNGImageEncoder.cpp
diff --git a/Source/platform/image-encoders/skia/PNGImageEncoder.cpp b/Source/platform/image-encoders/skia/PNGImageEncoder.cpp
index 225d7d793e795ae3b13b3908038e40e62436ce0d..9d21b9dbbb7671bcacfe976373be81aaff6bd541 100644
--- a/Source/platform/image-encoders/skia/PNGImageEncoder.cpp
+++ b/Source/platform/image-encoders/skia/PNGImageEncoder.cpp
@@ -121,6 +121,9 @@ bool PNGImageEncoder::encode(const SkBitmap& bitmap, Vector<unsigned char>* outp
if (bitmap.colorType() != kN32_SkColorType || !bitmap.getPixels())
return false; // Only support 32 bit/pixel skia bitmaps.
+ if (bitmap.width() <= 0 || bitmap.height() <= 0)
+ return false; // crbug.com/504690
+
return encodePixels(IntSize(bitmap.width(), bitmap.height()), static_cast<unsigned char*>(bitmap.getPixels()), true, output);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698