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

Unified Diff: chrome/browser/ui/views/certificate_selector.cc

Issue 2277133003: Fixed a crash in Chrome caused by duplicate certificates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comments, changed the fix Created 4 years, 4 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/views/certificate_selector.cc
diff --git a/chrome/browser/ui/views/certificate_selector.cc b/chrome/browser/ui/views/certificate_selector.cc
index f6cb4f7443b5f3bc19a98e229ecbb41e7786803f..c41fe5bdc9187efde0b5ff85a376cf02bd5c5450 100644
--- a/chrome/browser/ui/views/certificate_selector.cc
+++ b/chrome/browser/ui/views/certificate_selector.cc
@@ -130,6 +130,13 @@ CertificateSelector::CertificateSelector(
extensions::ExtensionRegistryFactory::GetForBrowserContext(
web_contents->GetBrowserContext());
+ // TODO(isandrk): See crbug.com/641440. A certificate that was previously
emaxx 2016/08/29 14:16:40 nit: I think it makes more sense to move this crbu
Ivan Šandrk 2016/08/29 15:07:49 Done.
+ // provided by *both* the TPM and an extension will get incorrectly
emaxx 2016/08/29 14:16:39 nit: I don't think that the text in comments shoul
emaxx 2016/08/29 14:16:40 nit: s/TPM/platform/ (this is a more generic and c
Ivan Šandrk 2016/08/29 15:07:49 Done.
+ // filtered out if the extension stops providing it (both instances will be
+ // filtered out). Hence the certificates_ array will be empty and an empty
+ // certificate selection dialog will be shown which will cause a crash
emaxx 2016/08/29 14:16:40 nit: I would suggest rephrasing this sentence in a
Ivan Šandrk 2016/08/29 15:07:49 Done.
+ // (temporary workaround added in CertificateSelector::Show to prevent the
+ // crash).
emaxx 2016/08/29 14:16:40 nit: Generally, why not move this text and merge w
Ivan Šandrk 2016/08/29 15:07:49 Done.
for (const auto& cert : certificates) {
std::string provider_name;
bool has_extension = false;
@@ -178,6 +185,13 @@ bool CertificateSelector::CanShow(content::WebContents* web_contents) {
void CertificateSelector::Show() {
constrained_window::ShowWebModalDialogViews(this, web_contents_);
+ // TODO(isandrk): Temporary workaround for crbug.com/641440. certificates_
+ // array may sometimes be empty by mistake.
+ if (certificates_.empty()) {
+ GetWidget()->Close();
+ return;
+ }
+
// Select the first row automatically. This must be done after the dialog has
// been created.
table_->Select(0);
« 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