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

Unified Diff: ppapi/shared_impl/resource_tracker.cc

Issue 7669055: Remove webkit::ppapi::Resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix self-assignment Created 9 years, 4 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
Index: ppapi/shared_impl/resource_tracker.cc
diff --git a/ppapi/shared_impl/resource_tracker.cc b/ppapi/shared_impl/resource_tracker.cc
index 70968125ab865b0d3819f06fbef1d887dc75d45c..bce7d5c7be698114718d74f5253b28720ea27d79 100644
--- a/ppapi/shared_impl/resource_tracker.cc
+++ b/ppapi/shared_impl/resource_tracker.cc
@@ -142,7 +142,12 @@ PP_Resource ResourceTracker::AddResource(Resource* object) {
// If you hit this somebody forgot to call DidCreateInstance or the resource
// was created with an invalid PP_Instance.
- DCHECK(instance_map_.find(object->pp_instance()) != instance_map_.end());
+ //
+ // 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.
+ CHECK(instance_map_.find(object->pp_instance()) != instance_map_.end());
viettrungluu 2011/08/22 23:19:46 Hrm, this could conceivably be a fairly hot method
PP_Resource new_id = MakeTypedId(++last_resource_value_, PP_ID_TYPE_RESOURCE);
instance_map_[object->pp_instance()]->resources.insert(new_id);

Powered by Google App Engine
This is Rietveld 408576698