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

Issue 2526283002: Handle empty string in GetSavePasswordDialogTitleTextAndLinkRange gracefully (Closed)

Created:
4 years ago by vabr (Chromium)
Modified:
4 years ago
Reviewers:
vasilii
CC:
chromium-reviews, gcasto+watchlist_chromium.org, vabr+watchlistpasswordmanager_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Handle empty string in GetSavePasswordDialogTitleTextAndLinkRange gracefully GetSavePasswordDialogTitleTextAndLinkRange currently assumes that localised strings for particular IDs contain placeholders, and attempts to access the vector of offsets corresponding to such placeholders. However, in some situations (http://crbug.com/658902#c18) the localised string may be empty. This led to an out-of-bounds access and crash on Android. This CL is the smallest change to handle such situation gracefully -- it checks the length of the vector with offsets and gives up accessing it if it is empty. This avoids the crash but results in displaying a UI with empty strings. Ideally, the UI would also be supressed on these occasions, but that is left for follow-up CLs. The current situation is already an improvement (password manager is still not very useful, but at least the browser has a chance to continue). The CL also removes the temporary logging put in for the crash investigation. BUG=658902 Committed: https://crrev.com/49ebcf7d64e71c7d3ac71bca66f65d61180bfb8c Cr-Commit-Position: refs/heads/master@{#434482}

Patch Set 1 #

Total comments: 6

Patch Set 2 : Better test clean-up #

Total comments: 2

Patch Set 3 : EXPECT_THAT #

Unified diffs Side-by-side diffs Delta from patch set Stats (+84 lines, -48 lines) Patch
M chrome/browser/ui/passwords/manage_passwords_view_utils.cc View 3 chunks +7 lines, -48 lines 0 comments Download
M chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc View 1 2 2 chunks +77 lines, -0 lines 0 comments Download

Messages

Total messages: 21 (13 generated)
vabr (Chromium)
Hi Vasilii, Could you please review? I might also bother you to discuss how/whether to ...
4 years ago (2016-11-24 16:00:24 UTC) #4
vasilii
https://codereview.chromium.org/2526283002/diff/1/chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc File chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc (right): https://codereview.chromium.org/2526283002/diff/1/chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc#newcode59 chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc:59: return true; It's strange to return true in production ...
4 years ago (2016-11-24 17:26:28 UTC) #7
vabr (Chromium)
Thanks for the review, Vasilii. Please have a look at my answers. Cheers, Vaclav https://codereview.chromium.org/2526283002/diff/1/chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc ...
4 years ago (2016-11-25 09:57:28 UTC) #10
vasilii
lgtm https://codereview.chromium.org/2526283002/diff/20001/chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc File chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc (right): https://codereview.chromium.org/2526283002/diff/20001/chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc#newcode200 chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc:200: EXPECT_TRUE(title.empty()) << "|title| is non-empty: " << title; ...
4 years ago (2016-11-25 10:47:24 UTC) #13
vabr (Chromium)
Thanks for the review! Vaclav https://codereview.chromium.org/2526283002/diff/20001/chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc File chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc (right): https://codereview.chromium.org/2526283002/diff/20001/chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc#newcode200 chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc:200: EXPECT_TRUE(title.empty()) << "|title| is ...
4 years ago (2016-11-25 11:22:53 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2526283002/40001
4 years ago (2016-11-25 11:23:03 UTC) #17
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years ago (2016-11-25 12:02:54 UTC) #19
commit-bot: I haz the power
4 years ago (2016-11-25 12:05:48 UTC) #21
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/49ebcf7d64e71c7d3ac71bca66f65d61180bfb8c
Cr-Commit-Position: refs/heads/master@{#434482}

Powered by Google App Engine
This is Rietveld 408576698