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

Unified Diff: webkit/plugins/npapi/plugin_list_posix.cc

Issue 10823132: Linux: Add more selective plugin blacklisting code. Blacklist a plugin that fails to check for SSE2… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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: webkit/plugins/npapi/plugin_list_posix.cc
===================================================================
--- webkit/plugins/npapi/plugin_list_posix.cc (revision 149455)
+++ webkit/plugins/npapi/plugin_list_posix.cc (working copy)
@@ -6,6 +6,7 @@
#include <algorithm>
+#include "base/cpu.h"
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/sha1.h"
@@ -23,6 +24,14 @@
typedef std::pair<FilePath, base::Time> FileAndTime;
typedef std::vector<FileAndTime> FileTimeList;
+enum PluginQuark {
Bernhard Bauer 2012/08/02 03:18:19 Do you mean quirk? Or am I missing something and w
Lei Zhang 2012/08/02 03:25:12 Done.
+ // No quarks - plugin is outright banned.
+ PLUGIN_QUARK_NONE = 0,
+ // Plugin is using SSE2 instructions without checking for SSE2 instruction
+ // support. Ban the plugin if the system has no SSE2 support.
+ PLUGIN_QUARK_MISSING_SSE2_CHECK = 1 << 0,
+};
+
// Comparator used to sort by descending mtime then ascending filename.
bool CompareTime(const FileAndTime& a, const FileAndTime& b) {
if (a.second == b.second) {
@@ -34,18 +43,40 @@
return a.second > b.second;
}
+// Checks to see if the current environment meets any of the condtions set in
+// |quarks|. Returns true if any of the conditions are met, or if |quarks| is
+// PLUGIN_QUARK_NONE.
+bool CheckQuarks(PluginQuark quarks) {
+ if (quarks == PLUGIN_QUARK_NONE)
Bernhard Bauer 2012/08/02 03:18:19 Can you convert this to a switch statement so that
Lei Zhang 2012/08/02 03:25:12 I hope we don't have to do this very often, but po
Bernhard Bauer 2012/08/02 04:10:31 Oh right, it's a bit field.
+ return true;
+
+ if ((quarks & PLUGIN_QUARK_MISSING_SSE2_CHECK) != 0) {
+ base::CPU cpu;
+ if (!cpu.has_sse2()) {
Bernhard Bauer 2012/08/02 03:18:19 Nit: no braces?
Lei Zhang 2012/08/02 03:25:12 Done.
+ return true;
+ }
+ }
+
+ return false;
+}
+
// Return true if |path| matches a known (file size, sha1sum) pair.
+// Also check against any PluginQuarks the bad plugin may have.
// 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) {
+bool IsBlacklistedBySha1sumAndQuarks(const FilePath& path) {
const struct BadEntry {
int64 size;
std::string sha1;
+ PluginQuark quarks;
} bad_entries[] = {
// Flash 9 r31 - http://crbug.com/29237
- { 7040080, "fa5803061125ca47846713b34a26a42f1f1e98bb" },
+ { 7040080, "fa5803061125ca47846713b34a26a42f1f1e98bb", PLUGIN_QUARK_NONE },
// Flash 9 r48 - http://crbug.com/29237
- { 7040036, "0c4b3768a6d4bfba003088e4b9090d381de1af2b" },
+ { 7040036, "0c4b3768a6d4bfba003088e4b9090d381de1af2b", PLUGIN_QUARK_NONE },
+ // Flash 11.2.202.236, 32-bit - http://crbug.com/140086
+ { 17406436, "1e07eac912faf9426c52a288c76c3b6238f90b6b",
+ PLUGIN_QUARK_MISSING_SSE2_CHECK },
};
int64 size;
@@ -63,7 +94,7 @@
for (size_t j = 0; j < sha1.size(); j++)
base::StringAppendF(&sha1_readable, "%02x", sha1[j] & 0xFF);
if (bad_entries[i].sha1 == sha1_readable)
- return true;
+ return CheckQuarks(bad_entries[i].quarks);
}
return false;
}
@@ -100,7 +131,7 @@
return true;
}
}
- return IsBlacklistedBySha1sum(path);
+ return IsBlacklistedBySha1sumAndQuarks(path);
}
} // namespace
« 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