diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-07 19:55:55 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-07 19:55:55 +0000 |
commit | 9274ead1c74ef0025072923f14aeaedd2598c0d6 (patch) | |
tree | baf28919c2f144b9009b6ba8d4470707ad2da7b8 /app/gtk_dnd_util.cc | |
parent | 5c311356f75f014502b63f1afa79c5452a0cfa59 (diff) | |
download | chromium_src-9274ead1c74ef0025072923f14aeaedd2598c0d6.zip chromium_src-9274ead1c74ef0025072923f14aeaedd2598c0d6.tar.gz chromium_src-9274ead1c74ef0025072923f14aeaedd2598c0d6.tar.bz2 |
gtk: Fix gtk_dnd_util::ExtractNamedURL to not crash on invalid data.
BUG=43347
TEST=included
Review URL: http://codereview.chromium.org/2003006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46731 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/gtk_dnd_util.cc')
-rw-r--r-- | app/gtk_dnd_util.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/gtk_dnd_util.cc b/app/gtk_dnd_util.cc index 343e3df..38d171b 100644 --- a/app/gtk_dnd_util.cc +++ b/app/gtk_dnd_util.cc @@ -1,9 +1,11 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "app/gtk_dnd_util.h" +#include <string> + #include "base/logging.h" #include "base/pickle.h" #include "base/utf_string_conversions.h" @@ -200,6 +202,9 @@ void WriteURLWithName(GtkSelectionData* selection_data, bool ExtractNamedURL(GtkSelectionData* selection_data, GURL* url, string16* title) { + if (!selection_data || selection_data->length <= 0) + return false; + Pickle data(reinterpret_cast<char*>(selection_data->data), selection_data->length); void* iter = NULL; |