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

Unified Diff: ui/gfx/codec/png_codec.cc

Issue 12313139: captureVisibleTab Extension API producing garbled PNG results (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: re-added properly cast dcheck Created 7 years, 9 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 | « AUTHORS ('k') | ui/gfx/codec/png_codec_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « AUTHORS ('k') | ui/gfx/codec/png_codec_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698