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

Side by Side Diff: content/browser/download/save_package.cc

Issue 1519283002: Fix a use-after-free of SaveFileCreateInfo in SaveFileManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
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/download/save_package.h" 5 #include "content/browser/download/save_package.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 file_name_set_.insert(file_name); 540 file_name_set_.insert(file_name);
541 } 541 }
542 542
543 DCHECK(!file_name.empty()); 543 DCHECK(!file_name.empty());
544 generated_name->assign(file_name); 544 generated_name->assign(file_name);
545 545
546 return true; 546 return true;
547 } 547 }
548 548
549 // We have received a message from SaveFileManager about a new saving job. We 549 // We have received a message from SaveFileManager about a new saving job. We
550 // create a SaveItem and store it in our in_progress list. 550 // find a SaveItem and store it in our in_progress list.
551 void SavePackage::StartSave(const SaveFileCreateInfo* info) { 551 void SavePackage::StartSave(const SaveFileCreateInfo* info) {
552 DCHECK(info && !info->url.is_empty()); 552 DCHECK(info && !info->url.is_empty());
553 553
554 SaveItemIdMap::iterator it = in_progress_items_.find(info->save_item_id); 554 SaveItemIdMap::iterator it = in_progress_items_.find(info->save_item_id);
555 if (it == in_progress_items_.end()) { 555 if (it == in_progress_items_.end()) {
556 // If not found, we must have cancel action. 556 // If not found, we must have cancel action.
557 DCHECK(canceled()); 557 DCHECK(canceled());
558 return; 558 return;
559 } 559 }
560 SaveItem* save_item = it->second; 560 SaveItem* save_item = it->second;
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 1492
1493 void SavePackage::FinalizeDownloadEntry() { 1493 void SavePackage::FinalizeDownloadEntry() {
1494 DCHECK(download_); 1494 DCHECK(download_);
1495 DCHECK(download_manager_); 1495 DCHECK(download_manager_);
1496 1496
1497 download_manager_->OnSavePackageSuccessfullyFinished(download_); 1497 download_manager_->OnSavePackageSuccessfullyFinished(download_);
1498 StopObservation(); 1498 StopObservation();
1499 } 1499 }
1500 1500
1501 } // namespace content 1501 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698