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

Unified Diff: content/common/plugin_list_win.cc

Issue 674073003: Only scan for correct architecture plugin binaries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests have a lot of subtle expectations, so leaving the logic exactly the same as before. Created 6 years, 2 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: content/common/plugin_list_win.cc
diff --git a/content/common/plugin_list_win.cc b/content/common/plugin_list_win.cc
index f58a167696533fbe12e5b2d87e7bfa77535a464f..c92ad9564f35366aa154482254932dd566d5208f 100644
--- a/content/common/plugin_list_win.cc
+++ b/content/common/plugin_list_win.cc
@@ -384,27 +384,44 @@ void PluginList::GetPluginPathsFromRegistry(
bool PluginList::ShouldLoadPluginUsingPluginList(
const WebPluginInfo& info,
std::vector<WebPluginInfo>* plugins) {
- bool should_check_version = true;
- {
- base::AutoLock lock(lock_);
- should_check_version =
- std::find(extra_plugin_paths_.begin(), extra_plugin_paths_.end(),
- info.path) == extra_plugin_paths_.end();
+ bool wrong_architecture = false;
+
+ if (info.type == WebPluginInfo::PLUGIN_TYPE_NPAPI) {
+ base::FilePath plugin_path(info.path);
+#if defined(ARCH_CPU_X86_64)
+ // The plugin in question could be a 32 bit plugin which we cannot load.
+ if (IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path)))
+ wrong_architecture = true;
+#else
+ // The plugin in question could be a 64 bit plugin which we cannot load.
+ if (!IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path)))
+ wrong_architecture = true;
+#endif
}
- // Version check for plugins that are not coming from |extra_plugin_paths_|.
- if (should_check_version) {
- for (size_t j = 0; j < plugins->size(); ++j) {
- base::FilePath::StringType plugin1 =
- base::StringToLowerASCII((*plugins)[j].path.BaseName().value());
- base::FilePath::StringType plugin2 =
- base::StringToLowerASCII(info.path.BaseName().value());
- if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) ||
- (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) ||
- (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) {
- if (IsNewerVersion(info.version, (*plugins)[j].version))
- return false; // We have loaded a plugin whose version is newer.
- plugins->erase(plugins->begin() + j);
- break;
+
ananta 2014/11/03 20:28:04 Can we bail if wrong_architecture is true? here?
Bernhard Bauer 2014/11/03 22:24:22 Alternatively: bool should_check_version; if
+ if (!wrong_architecture) {
+ bool should_check_version = true;
+ {
+ base::AutoLock lock(lock_);
+ should_check_version =
+ std::find(extra_plugin_paths_.begin(), extra_plugin_paths_.end(),
+ info.path) == extra_plugin_paths_.end();
+ }
+ // Version check for plugins that are not coming from |extra_plugin_paths_|.
+ if (should_check_version) {
+ for (size_t j = 0; j < plugins->size(); ++j) {
+ base::FilePath::StringType plugin1 =
+ base::StringToLowerASCII((*plugins)[j].path.BaseName().value());
+ base::FilePath::StringType plugin2 =
+ base::StringToLowerASCII(info.path.BaseName().value());
+ if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) ||
+ (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) ||
+ (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) {
+ if (IsNewerVersion(info.version, (*plugins)[j].version))
+ return false; // We have loaded a plugin whose version is newer.
+ plugins->erase(plugins->begin() + j);
+ break;
+ }
}
}
}
@@ -474,16 +491,9 @@ bool PluginList::ShouldLoadPluginUsingPluginList(
}
}
- base::FilePath plugin_path(info.path);
-#if defined(ARCH_CPU_X86_64)
- // The plugin in question could be a 32 bit plugin which we cannot load.
- if (IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path)))
+ if (wrong_architecture)
return false;
-#else
- // The plugin in question could be a 64 bit plugin which we cannot load.
- if (!IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path)))
- return false;
-#endif
+
return true;
}
« 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