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

Unified Diff: chrome/browser/autocomplete/history_url_provider.cc

Issue 7822009: Fix crash in CanFindIntranetURL() due to FixupUserInput() changing the AutocompleteInput's text_ ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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
Index: chrome/browser/autocomplete/history_url_provider.cc
===================================================================
--- chrome/browser/autocomplete/history_url_provider.cc (revision 98899)
+++ chrome/browser/autocomplete/history_url_provider.cc (working copy)
@@ -534,17 +534,8 @@
if (fixup_input_and_run_pass_1) {
// Do some fixup on the user input before matching against it, so we provide
// good results for local file paths, input with spaces, etc.
- // NOTE: This purposefully doesn't take input.desired_tld() into account; if
- // it did, then holding "ctrl" would change all the results from the
- // HistoryURLProvider provider, not just the What You Typed Result.
- const string16 fixed_text(FixupUserInput(input));
- if (fixed_text.empty()) {
- // Conceivably fixup could result in an empty string (although I don't
- // have cases where this happens offhand). We can't do anything with
- // empty input, so just bail; otherwise we'd crash later.
+ if (!FixupUserInput(&params->input))
return;
- }
- params->input.set_text(fixed_text);
// Pass 1: Get the in-memory URL database, and use it to find and promote
// the inline autocomplete match, if any.
@@ -725,10 +716,14 @@
bool HistoryURLProvider::CanFindIntranetURL(
history::URLDatabase* db,
const AutocompleteInput& input) const {
+ // Normally passing the first two conditions below ought to guarantee the
+ // third condition, but because FixupUserInput() can run and modify the
+ // input's text and parts between Parse() and here, it seems better to be
+ // paranoid and check.
if ((input.type() != AutocompleteInput::UNKNOWN) ||
- !LowerCaseEqualsASCII(input.scheme(), chrome::kHttpScheme))
+ !LowerCaseEqualsASCII(input.scheme(), chrome::kHttpScheme) ||
+ !input.parts().host.is_nonempty())
return false;
- DCHECK(input.parts().host.is_nonempty());
const string16 host(input.text().substr(input.parts().host.begin,
input.parts().host.len));
if (net::RegistryControlledDomainService::GetRegistryLength(
« no previous file with comments | « chrome/browser/autocomplete/history_quick_provider.cc ('k') | chrome/browser/autocomplete/history_url_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698