Index: ui/gfx/codec/png_codec.cc |
diff --git a/ui/gfx/codec/png_codec.cc b/ui/gfx/codec/png_codec.cc |
index 1b8b5c77d910d20d7babcd12f4518e56172439a5..135c548f2088b1ef8742ae9cad4b7b591d085d96 100644 |
--- a/ui/gfx/codec/png_codec.cc |
+++ b/ui/gfx/codec/png_codec.cc |
@@ -768,10 +768,11 @@ bool PNGCodec::EncodeBGRASkBitmap(const SkBitmap& input, |
if (input.empty()) |
return false; |
DCHECK(input.bytesPerPixel() == bbp); |
+ DCHECK(static_cast<int>(input.rowBytes()) >= input.width() * bbp); |
return Encode(reinterpret_cast<unsigned char*>(input.getAddr32(0, 0)), |
FORMAT_SkBitmap, Size(input.width(), input.height()), |
- input.width() * bbp, discard_transparency, |
+ static_cast<int>(input.rowBytes()), discard_transparency, |
std::vector<Comment>(), output); |
} |