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

Unified Diff: extensions/common/url_pattern.cc

Issue 364703002: Return if a host name in an URLPattern has no non-whitespace characters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 | extensions/common/url_pattern_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/url_pattern.cc
diff --git a/extensions/common/url_pattern.cc b/extensions/common/url_pattern.cc
index c7a3711e039fee6a7eb5b0f1c79ea7e111b2dd3f..6eb6c8c2c17c9912376cc2858dc09cec788d4f11 100644
--- a/extensions/common/url_pattern.cc
+++ b/extensions/common/url_pattern.cc
@@ -219,6 +219,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(),
« no previous file with comments | « no previous file | extensions/common/url_pattern_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698