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

Unified Diff: chrome/browser/ui/passwords/password_manager_presenter.cc

Issue 1855973002: [Password Manager] |index| in requests to PasswordManagerPresenter might be out of bounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/passwords/password_manager_presenter.cc
diff --git a/chrome/browser/ui/passwords/password_manager_presenter.cc b/chrome/browser/ui/passwords/password_manager_presenter.cc
index a7b8980e7307999628a841636d7b0ab1846fe35f..272ca70fd84bc9777fff6532e76be05bbd362546 100644
--- a/chrome/browser/ui/passwords/password_manager_presenter.cc
+++ b/chrome/browser/ui/passwords/password_manager_presenter.cc
@@ -182,9 +182,10 @@ void PasswordManagerPresenter::UpdatePasswordLists() {
void PasswordManagerPresenter::RemoveSavedPassword(size_t index) {
if (index >= password_list_.size()) {
- // |index| out of bounds might come from a compromised renderer, don't let
- // it crash the browser. http://crbug.com/362054
- NOTREACHED();
+ // |index| out of bounds might come from a compromised renderer
+ // (http://crbug.com/362054), or the user removed a password while a request
+ // to the store is in progress (i.e. |password_list_| is empty).
+ // Don't let it crash the browser.
return;
}
PasswordStore* store = GetPasswordStore();
@@ -200,9 +201,10 @@ void PasswordManagerPresenter::RemoveSavedPassword(size_t index) {
void PasswordManagerPresenter::RemovePasswordException(size_t index) {
if (index >= password_exception_list_.size()) {
- // |index| out of bounds might come from a compromised renderer, don't let
- // it crash the browser. http://crbug.com/362054
- NOTREACHED();
+ // |index| out of bounds might come from a compromised renderer
+ // (http://crbug.com/362054), or the user removed a password exception while
+ // a request to the store is in progress (i.e. |password_exception_list_|
+ // is empty). Don't let it crash the browser.
return;
}
PasswordStore* store = GetPasswordStore();
@@ -218,9 +220,10 @@ void PasswordManagerPresenter::RemovePasswordException(size_t index) {
void PasswordManagerPresenter::RequestShowPassword(size_t index) {
#if !defined(OS_ANDROID) // This is never called on Android.
if (index >= password_list_.size()) {
- // |index| out of bounds might come from a compromised renderer, don't let
- // it crash the browser. http://crbug.com/362054
- NOTREACHED();
+ // |index| out of bounds might come from a compromised renderer
+ // (http://crbug.com/362054), or the user requested to show a password while
+ // a request to the store is in progress (i.e. |password_list_|
+ // is empty). Don't let it crash the browser.
return;
}
if ((base::TimeTicks::Now() - last_authentication_time_) >
@@ -265,9 +268,10 @@ void PasswordManagerPresenter::RequestShowPassword(size_t index) {
const autofill::PasswordForm* PasswordManagerPresenter::GetPassword(
size_t index) {
if (index >= password_list_.size()) {
- // |index| out of bounds might come from a compromised renderer, don't let
- // it crash the browser. http://crbug.com/362054
- NOTREACHED();
+ // |index| out of bounds might come from a compromised renderer
+ // (http://crbug.com/362054), or the user requested to get a password while
+ // a request to the store is in progress (i.e. |password_list_|
+ // is empty). Don't let it crash the browser.
return NULL;
}
return password_list_[index].get();
@@ -276,9 +280,10 @@ const autofill::PasswordForm* PasswordManagerPresenter::GetPassword(
const autofill::PasswordForm* PasswordManagerPresenter::GetPasswordException(
size_t index) {
if (index >= password_exception_list_.size()) {
- // |index| out of bounds might come from a compromised renderer, don't let
- // it crash the browser. http://crbug.com/362054
- NOTREACHED();
+ // |index| out of bounds might come from a compromised renderer
+ // (http://crbug.com/362054), or the user requested to get a password
+ // exception while a request to the store is in progress (i.e.
+ // |password_exception_list_| is empty). Don't let it crash the browser.
return NULL;
}
return password_exception_list_[index].get();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698