diff options
author | rob@robwu.nl <rob@robwu.nl@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-02 01:31:55 +0000 |
---|---|---|
committer | rob@robwu.nl <rob@robwu.nl@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-02 01:31:55 +0000 |
commit | d013efc32e29077d3e85b007546c3a65039ae3c2 (patch) | |
tree | 54084fe5bb02b1a5f5886603960fdd9fede23f79 /extensions/common/url_pattern.cc | |
parent | 690117c4a57385facafbbe1c056e7bc3aa319981 (diff) | |
download | chromium_src-d013efc32e29077d3e85b007546c3a65039ae3c2.zip chromium_src-d013efc32e29077d3e85b007546c3a65039ae3c2.tar.gz chromium_src-d013efc32e29077d3e85b007546c3a65039ae3c2.tar.bz2 |
Return if a host name in an URLPattern has no non-whitespace characters.
SplitString trims whitespace, so the |host_components| vector could be empty.
BUG=390645
TEST=ExtensionURLPatternTest.ParseInvalid
Review URL: https://codereview.chromium.org/364703002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280935 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions/common/url_pattern.cc')
-rw-r--r-- | extensions/common/url_pattern.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/extensions/common/url_pattern.cc b/extensions/common/url_pattern.cc index ee7d164..b667981 100644 --- a/extensions/common/url_pattern.cc +++ b/extensions/common/url_pattern.cc @@ -228,6 +228,11 @@ URLPattern::ParseResult URLPattern::Parse(const std::string& pattern) { // The first component can optionally be '*' to match all subdomains. std::vector<std::string> host_components; base::SplitString(host_, '.', &host_components); + + // Could be empty if the host only consists of whitespace characters. + if (host_components.empty()) + return PARSE_ERROR_EMPTY_HOST; + if (host_components[0] == "*") { match_subdomains_ = true; host_components.erase(host_components.begin(), |