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

Side by Side Diff: content/browser/appcache/appcache_update_job.cc

Issue 1418783005: Fix possible map::end() dereference in AppCacheUpdateJob triggered by a compromised renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move check to host, add unittest Created 5 years, 1 month 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
« no previous file with comments | « content/browser/appcache/appcache_host_unittest.cc ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/appcache/appcache_update_job.h" 5 #include "content/browser/appcache/appcache_update_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 1098
1099 AppCache* newest_cache = group_->newest_complete_cache(); 1099 AppCache* newest_cache = group_->newest_complete_cache();
1100 if (newest_cache) 1100 if (newest_cache)
1101 host_notifier->AddHosts(newest_cache->associated_hosts()); 1101 host_notifier->AddHosts(newest_cache->associated_hosts());
1102 } 1102 }
1103 1103
1104 void AppCacheUpdateJob::OnDestructionImminent(AppCacheHost* host) { 1104 void AppCacheUpdateJob::OnDestructionImminent(AppCacheHost* host) {
1105 // The host is about to be deleted; remove from our collection. 1105 // The host is about to be deleted; remove from our collection.
1106 PendingMasters::iterator found = 1106 PendingMasters::iterator found =
1107 pending_master_entries_.find(host->pending_master_entry_url()); 1107 pending_master_entries_.find(host->pending_master_entry_url());
1108 DCHECK(found != pending_master_entries_.end()); 1108 CHECK(found != pending_master_entries_.end());
1109 PendingHosts& hosts = found->second; 1109 PendingHosts& hosts = found->second;
1110 PendingHosts::iterator it = std::find(hosts.begin(), hosts.end(), host); 1110 PendingHosts::iterator it = std::find(hosts.begin(), hosts.end(), host);
1111 DCHECK(it != hosts.end()); 1111 CHECK(it != hosts.end());
1112 hosts.erase(it); 1112 hosts.erase(it);
1113 } 1113 }
1114 1114
1115 void AppCacheUpdateJob::OnServiceReinitialized( 1115 void AppCacheUpdateJob::OnServiceReinitialized(
1116 AppCacheStorageReference* old_storage_ref) { 1116 AppCacheStorageReference* old_storage_ref) {
1117 // We continue to use the disabled instance, but arrange for its 1117 // We continue to use the disabled instance, but arrange for its
1118 // deletion when its no longer needed. 1118 // deletion when its no longer needed.
1119 if (old_storage_ref->storage() == storage_) 1119 if (old_storage_ref->storage() == storage_)
1120 disabled_storage_reference_ = old_storage_ref; 1120 disabled_storage_reference_ = old_storage_ref;
1121 } 1121 }
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 // on this object after we've posted a task to delete ourselves. 1698 // on this object after we've posted a task to delete ourselves.
1699 if (group_) { 1699 if (group_) {
1700 group_->SetUpdateAppCacheStatus(AppCacheGroup::IDLE); 1700 group_->SetUpdateAppCacheStatus(AppCacheGroup::IDLE);
1701 group_ = NULL; 1701 group_ = NULL;
1702 } 1702 }
1703 1703
1704 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 1704 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
1705 } 1705 }
1706 1706
1707 } // namespace content 1707 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_host_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698