Chromium Code Reviews| 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); |