summaryrefslogtreecommitdiffstats
path: root/chrome/plugin
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-22 22:19:39 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-22 22:19:39 +0000
commitc6dff1aef99cbdaf83be46a239fb83155ebf90df (patch)
treed53bb3c26e023da0d582207259f465505ae94929 /chrome/plugin
parent18a9799138ba0ff5ab821fd2673eb8a9a60b0642 (diff)
downloadchromium_src-c6dff1aef99cbdaf83be46a239fb83155ebf90df.zip
chromium_src-c6dff1aef99cbdaf83be46a239fb83155ebf90df.tar.gz
chromium_src-c6dff1aef99cbdaf83be46a239fb83155ebf90df.tar.bz2
Committing change by Thatcher Ulrich <tulrich@google.com> from http://codereview.chromium.org/543097
Check NPClass::structVersion before accessing fields that don't exist in all versions: NPClass::constructor and NPClass::enumerate BUG=32387 TESTED=manual and in debugger Review URL: http://codereview.chromium.org/545176 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36911 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r--chrome/plugin/npobject_proxy.cc12
-rw-r--r--chrome/plugin/npobject_stub.cc6
2 files changed, 14 insertions, 4 deletions
diff --git a/chrome/plugin/npobject_proxy.cc b/chrome/plugin/npobject_proxy.cc
index aff1bcd..2601476 100644
--- a/chrome/plugin/npobject_proxy.cc
+++ b/chrome/plugin/npobject_proxy.cc
@@ -355,7 +355,11 @@ bool NPObjectProxy::NPNEnumerate(NPObject *obj,
bool result = false;
NPObjectProxy* proxy = GetProxy(obj);
if (!proxy) {
- return obj->_class->enumerate(obj, value, count);
+ if (obj->_class->structVersion >= NP_CLASS_STRUCT_VERSION_ENUM) {
+ return obj->_class->enumerate(obj, value, count);
+ } else {
+ return false;
+ }
}
std::vector<NPIdentifier_Param> value_param;
@@ -385,7 +389,11 @@ bool NPObjectProxy::NPNConstruct(NPObject *obj,
NPObjectProxy* proxy = GetProxy(obj);
if (!proxy) {
- return obj->_class->construct(obj, args, arg_count, np_result);
+ if (obj->_class->structVersion >= NP_CLASS_STRUCT_VERSION_CTOR) {
+ return obj->_class->construct(obj, args, arg_count, np_result);
+ } else {
+ return false;
+ }
}
bool result = false;
diff --git a/chrome/plugin/npobject_stub.cc b/chrome/plugin/npobject_stub.cc
index ec69c43..18e5b4c 100644
--- a/chrome/plugin/npobject_stub.cc
+++ b/chrome/plugin/npobject_stub.cc
@@ -292,7 +292,8 @@ void NPObjectStub::OnEnumeration(std::vector<NPIdentifier_Param>* value,
if (!IsPluginProcess()) {
*result = WebBindings::enumerate(0, npobject_, &value_np, &count);
} else {
- if (!npobject_->_class->enumerate) {
+ if (npobject_->_class->structVersion < NP_CLASS_STRUCT_VERSION_ENUM ||
+ !npobject_->_class->enumerate) {
*result = false;
return;
}
@@ -335,7 +336,8 @@ void NPObjectStub::OnConstruct(const std::vector<NPVariant_Param>& args,
}
if (IsPluginProcess()) {
- if (npobject_->_class->construct) {
+ if (npobject_->_class->structVersion >= NP_CLASS_STRUCT_VERSION_CTOR &&
+ npobject_->_class->construct) {
return_value = npobject_->_class->construct(
npobject_, args_var, arg_count, &result_var);
} else {