diff options
author | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-26 20:48:06 +0000 |
---|---|---|
committer | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-26 20:48:06 +0000 |
commit | e5117c038e9262a4596d3c618846e898c1a9274e (patch) | |
tree | 9ba0190c65196e5aff571d2330fd8a5d52a92ad7 | |
parent | 2b2e4c12ef8f14657231319b71e40e0ea6920c8a (diff) | |
download | chromium_src-e5117c038e9262a4596d3c618846e898c1a9274e.zip chromium_src-e5117c038e9262a4596d3c618846e898c1a9274e.tar.gz chromium_src-e5117c038e9262a4596d3c618846e898c1a9274e.tar.bz2 |
Merge 98361 - Fix missing null check in Clipboard::ReadImage.
Even though CF_DIB is always supposed to be synthesized from CF_BITMAP, change
the types to match in Clipboard::ReadAvailableTypes. We also add a NULL check
in Clipboard::ReadImage in case the contents of the clipboard change between the
time the clipboard types are accessed and the the clipboard content is accessed.
BUG=94332
TEST=none
Review URL: http://codereview.chromium.org/7741035
TBR=dcheng@chromium.org
Review URL: http://codereview.chromium.org/7762005
git-svn-id: svn://svn.chromium.org/chrome/branches/835/src@98483 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ui/base/clipboard/clipboard_win.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ui/base/clipboard/clipboard_win.cc b/ui/base/clipboard/clipboard_win.cc index 434b9f9..cec0601 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: |