summaryrefslogtreecommitdiffstats
path: root/webkit/plugins/npapi
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 18:19:49 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 18:19:49 +0000
commit121648a44c1bc7e210646387e12fa965e890943c (patch)
tree34b8852783e0a56b099f5c2338d26b0c5abf5e50 /webkit/plugins/npapi
parent2f86595354652700034e0aa8a75b90c54bf1cc2a (diff)
downloadchromium_src-121648a44c1bc7e210646387e12fa965e890943c.zip
chromium_src-121648a44c1bc7e210646387e12fa965e890943c.tar.gz
chromium_src-121648a44c1bc7e210646387e12fa965e890943c.tar.bz2
While enumerating plugins under the MozillaPlugins registry key, we should ignore 64 bit
plugins. We validate whether a plugin is a 32 bit dll by reading its PE image. This fixes bug http://code.google.com/p/chromium/issues/detail?id=73032 Added support for the win32 version of the MemoryMappedFile helper class in base to map a file as an image section. BUG=73032 TEST=As described in the bug at this point. Review URL: http://codereview.chromium.org/6611028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76934 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins/npapi')
-rw-r--r--webkit/plugins/npapi/plugin_list_win.cc28
1 files changed, 27 insertions, 1 deletions
diff --git a/webkit/plugins/npapi/plugin_list_win.cc b/webkit/plugins/npapi/plugin_list_win.cc
index 22eb670..95004f8 100644
--- a/webkit/plugins/npapi/plugin_list_win.cc
+++ b/webkit/plugins/npapi/plugin_list_win.cc
@@ -16,7 +16,9 @@
#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/string_util.h"
+#include "base/win/pe_image.h"
#include "base/win/registry.h"
+#include "base/win/scoped_handle.h"
#include "webkit/plugins/npapi/plugin_constants_win.h"
#include "webkit/plugins/npapi/plugin_lib.h"
#include "webkit/plugins/plugin_switches.h"
@@ -215,6 +217,18 @@ void GetJavaDirectory(std::set<FilePath>* plugin_dirs) {
}
}
+bool IsValid32BitImage(FilePath path) {
+ file_util::MemoryMappedFile plugin_image;
+
+ if (!plugin_image.InitializeAsImageSection(path))
+ return false;
+
+ base::win::PEImage image(plugin_image.data());
+
+ PIMAGE_NT_HEADERS nt_headers = image.GetNTHeaders();
+ return (nt_headers->FileHeader.Machine == IMAGE_FILE_MACHINE_I386);
+}
+
} // anonymous namespace
void PluginList::PlatformInit() {
@@ -421,7 +435,19 @@ bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info,
}
}
- return true;
+ HMODULE plugin_dll = NULL;
+ bool load_plugin = true;
+
+ // The plugin list could contain a 64 bit plugin which we cannot load.
+ for (size_t i = 0; i < internal_plugins_.size(); ++i) {
+ if (info.path == internal_plugins_[i].info.path)
+ continue;
+
+ if (!IsValid32BitImage(info.path))
+ load_plugin = false;
+ break;
+ }
+ return load_plugin;
}
} // namespace npapi