summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-14 19:28:32 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-14 19:28:32 +0000
commit09cb52eeaeadcb21c196a884e4e2229f350a66a5 (patch)
tree59a7ab6f9b5e8a0c50db76487f8f1220f06be5d9 /ppapi
parentde1933bfeaa6bb2cbd4e022b5df44ca4c79ba87a (diff)
downloadchromium_src-09cb52eeaeadcb21c196a884e4e2229f350a66a5.zip
chromium_src-09cb52eeaeadcb21c196a884e4e2229f350a66a5.tar.gz
chromium_src-09cb52eeaeadcb21c196a884e4e2229f350a66a5.tar.bz2
Check for a crashed plugin before creating resources to send to the plugin
BUG=95710 Review URL: http://codereview.chromium.org/7839040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101119 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/shared_impl/resource_tracker.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/ppapi/shared_impl/resource_tracker.cc b/ppapi/shared_impl/resource_tracker.cc
index 6762aea..303e980 100644
--- a/ppapi/shared_impl/resource_tracker.cc
+++ b/ppapi/shared_impl/resource_tracker.cc
@@ -140,15 +140,14 @@ PP_Resource ResourceTracker::AddResource(Resource* object) {
if (last_resource_value_ == kMaxPPId)
return 0;
- // If you hit this somebody forgot to call DidCreateInstance or the resource
- // was created with an invalid PP_Instance.
- //
- // This is specifically a check even in release mode. When creating resources
- // it can be easy to forget to validate the instance parameter. If somebody
- // does forget, we don't want to introduce a vulnerability with invalid
- // pointers floating around, so we die ASAP.
InstanceMap::iterator found = instance_map_.find(object->pp_instance());
- CHECK(found != instance_map_.end());
+ if (found == instance_map_.end()) {
+ // If you hit this, it's likely somebody forgot to call DidCreateInstance,
+ // the resource was created with an invalid PP_Instance, or the renderer
+ // side tried to create a resource for a plugin that crashed.
+ NOTREACHED();
+ return 0;
+ }
PP_Resource new_id = MakeTypedId(++last_resource_value_, PP_ID_TYPE_RESOURCE);
found->second->resources.insert(new_id);