diff options
| author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-30 22:10:35 +0000 |
|---|---|---|
| committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-30 22:10:35 +0000 |
| commit | bab75a0c160652ed8181fe51e38217cf3425ebcf (patch) | |
| tree | 2423734dc735648d578727f822be6aabe34190e3 /webkit | |
| parent | ce51555b5fa4e12e6540fb687dbf843a0316b140 (diff) | |
| download | chromium_src-bab75a0c160652ed8181fe51e38217cf3425ebcf.zip chromium_src-bab75a0c160652ed8181fe51e38217cf3425ebcf.tar.gz chromium_src-bab75a0c160652ed8181fe51e38217cf3425ebcf.tar.bz2 | |
Linux: Blacklist a couple of known to be bad copies of Flash 9.
BUG=29237
TEST=Flash 9 r31/r48 in ~/.mozilla/plugins no longer get preference over the system Flash.
Review URL: http://codereview.chromium.org/2829029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51300 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
| -rw-r--r-- | webkit/glue/plugins/plugin_list_posix.cc | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/webkit/glue/plugins/plugin_list_posix.cc b/webkit/glue/plugins/plugin_list_posix.cc index 1ad742d..1fbd76f 100644 --- a/webkit/glue/plugins/plugin_list_posix.cc +++ b/webkit/glue/plugins/plugin_list_posix.cc @@ -6,6 +6,7 @@ #include "base/file_util.h" #include "base/path_service.h" +#include "base/sha1.h" #include "base/string_util.h" #include "build/build_config.h" @@ -26,6 +27,40 @@ bool CompareTime(const FileAndTime& a, const FileAndTime& b) { return a.second > b.second; } +// Return true if |path| matches a known (file size, sha1sum) pair. +// The use of the file size is an optimization so we don't have to read in +// the entire file unless we have to. +bool IsBlacklistedBySha1sum(const FilePath& path) { + const struct BadEntry { + int64 size; + std::string sha1; + } bad_entries[] = { + // Flash 9 r31 - http://crbug.com/29237 + { 7040080, "fa5803061125ca47846713b34a26a42f1f1e98bb" }, + // Flash 9 r48 - http://crbug.com/29237 + { 7040036, "0c4b3768a6d4bfba003088e4b9090d381de1af2b" }, + }; + + int64 size; + if (!file_util::GetFileSize(path, &size)) + return false; + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(bad_entries); i++) { + if (bad_entries[i].size != size) + continue; + + std::string file_content; + if (!file_util::ReadFileToString(path, &file_content)) + continue; + std::string sha1 = base::SHA1HashString(file_content); + std::string sha1_readable; + for (size_t j = 0; j < sha1.size(); j++) + StringAppendF(&sha1_readable, "%02x", sha1[j] & 0xFF); + if (bad_entries[i].sha1 == sha1_readable) + return true; + } + return false; +} + // Some plugins are shells around other plugins; we prefer to use the // real plugin directly, if it's available. This function returns // true if we should prefer other plugins over this one. We'll still @@ -61,7 +96,7 @@ bool IsBlacklistedPlugin(const FilePath& path) { return true; } } - return false; + return IsBlacklistedBySha1sum(path); } } // anonymous namespace |
