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

Unified Diff: ui/base/clipboard/clipboard_win.cc

Issue 7741035: Fix missing null check in Clipboard::ReadImage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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: ui/base/clipboard/clipboard_win.cc
diff --git a/ui/base/clipboard/clipboard_win.cc b/ui/base/clipboard/clipboard_win.cc
index 434b9f96b10bd9b16866d76ae4d5a105ef61e930..cec06012fbf50e9540fe27d69155a15eba6122e2 100644
--- a/ui/base/clipboard/clipboard_win.cc
+++ b/ui/base/clipboard/clipboard_win.cc
@@ -352,7 +352,7 @@ void Clipboard::ReadAvailableTypes(Clipboard::Buffer buffer,
types->push_back(UTF8ToUTF16(kMimeTypeText));
if (::IsClipboardFormatAvailable(htmlFormat->cfFormat))
types->push_back(UTF8ToUTF16(kMimeTypeHTML));
- if (::IsClipboardFormatAvailable(CF_BITMAP))
+ if (::IsClipboardFormatAvailable(CF_DIB))
types->push_back(UTF8ToUTF16(kMimeTypePNG));
*contains_filenames = false;
}
@@ -442,6 +442,8 @@ SkBitmap Clipboard::ReadImage(Buffer buffer) const {
// HBITMAP returned from ::GetClipboardData(CF_BITMAP) always reports a color
// depth of 32bpp.
BITMAPINFO* bitmap = static_cast<BITMAPINFO*>(::GetClipboardData(CF_DIB));
+ if (!bitmap)
+ return SkBitmap();
int color_table_length = 0;
switch (bitmap->bmiHeader.biBitCount) {
case 1:
« 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