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

Unified Diff: chrome/common/extensions/extension.cc

Issue 10833014: Coverity fixlet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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/common/extensions/extension.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 99ad3f7f50e243b3487c812072fbe7ea5c6ec0ec..3626cfd900f578f9f6a5143c019b3f92f350cb6c 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1610,7 +1610,11 @@ bool Extension::LoadWebAccessibleResources(string16* error) {
return false;
}
URLPattern pattern(URLPattern::SCHEME_EXTENSION);
- pattern.Parse(extension_url_.spec());
+ if (pattern.Parse(extension_url_.spec()) != URLPattern::PARSE_SUCCESS) {
+ *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
+ errors::kInvalidURLPatternError, extension_url_.spec());
+ return false;
+ }
while (relative_path[0] == '/')
relative_path = relative_path.substr(1, relative_path.length() - 1);
pattern.SetPath(pattern.path() + relative_path);
@@ -1637,7 +1641,11 @@ bool Extension::LoadSandboxedPages(string16* error) {
return false;
}
URLPattern pattern(URLPattern::SCHEME_EXTENSION);
- pattern.Parse(extension_url_.spec());
+ if (pattern.Parse(extension_url_.spec()) != URLPattern::PARSE_SUCCESS) {
+ *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
+ errors::kInvalidURLPatternError, extension_url_.spec());
+ return false;
+ }
while (relative_path[0] == '/')
relative_path = relative_path.substr(1, relative_path.length() - 1);
pattern.SetPath(pattern.path() + relative_path);

Powered by Google App Engine
This is Rietveld 408576698