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

Side by Side Diff: webkit/plugins/npapi/plugin_group.cc

Issue 6579004: Don't access WebPluginInfo array out of bounds in PluginGroup::RemovePlugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/plugins/npapi/plugin_group_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "webkit/plugins/npapi/plugin_group.h" 7 #include "webkit/plugins/npapi/plugin_group.h"
8 8
9 #include "base/linked_ptr.h" 9 #include "base/linked_ptr.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 return; 239 return;
240 } 240 }
241 } 241 }
242 web_plugin_infos_.push_back(plugin); 242 web_plugin_infos_.push_back(plugin);
243 UpdateActivePlugin(web_plugin_infos_.back()); 243 UpdateActivePlugin(web_plugin_infos_.back());
244 } 244 }
245 245
246 bool PluginGroup::RemovePlugin(const FilePath& filename) { 246 bool PluginGroup::RemovePlugin(const FilePath& filename) {
247 bool did_remove = false; 247 bool did_remove = false;
248 ResetGroupState(); 248 ResetGroupState();
249 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { 249 for (size_t i = 0; i < web_plugin_infos_.size();) {
250 if (web_plugin_infos_[i].path == filename) { 250 if (web_plugin_infos_[i].path == filename) {
251 web_plugin_infos_.erase(web_plugin_infos_.begin() + i); 251 web_plugin_infos_.erase(web_plugin_infos_.begin() + i);
252 did_remove = true; 252 did_remove = true;
253 } else {
254 UpdateActivePlugin(web_plugin_infos_[i]);
255 i++;
253 } 256 }
254 UpdateActivePlugin(web_plugin_infos_[i]);
255 } 257 }
256 return did_remove; 258 return did_remove;
257 } 259 }
258 260
259 bool PluginGroup::EnablePlugin(const FilePath& filename) { 261 bool PluginGroup::EnablePlugin(const FilePath& filename) {
260 bool did_enable = false; 262 bool did_enable = false;
261 ResetGroupState(); 263 ResetGroupState();
262 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { 264 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) {
263 if (web_plugin_infos_[i].path == filename) 265 if (web_plugin_infos_[i].path == filename)
264 did_enable = Enable(&web_plugin_infos_[i], WebPluginInfo::USER_ENABLED); 266 did_enable = Enable(&web_plugin_infos_[i], WebPluginInfo::USER_ENABLED);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 // Only changeable if not managed. 523 // Only changeable if not managed.
522 if (plugin->enabled & WebPluginInfo::MANAGED_MASK) 524 if (plugin->enabled & WebPluginInfo::MANAGED_MASK)
523 return false; 525 return false;
524 plugin->enabled = new_reason; 526 plugin->enabled = new_reason;
525 } 527 }
526 return true; 528 return true;
527 } 529 }
528 530
529 } // namespace npapi 531 } // namespace npapi
530 } // namespace webkit 532 } // namespace webkit
OLDNEW
« no previous file with comments | « no previous file | webkit/plugins/npapi/plugin_group_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698