summaryrefslogtreecommitdiffstats
path: root/url/url_canon_relative.cc
diff options
context:
space:
mode:
authorbrettw <brettw@chromium.org>2015-02-17 17:51:33 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-18 01:53:06 +0000
commite66ce87932cfe85a770e11086b3f2054ab42839e (patch)
tree9c61e10a006f4ad3b2f774050cd953a65da371a8 /url/url_canon_relative.cc
parent655c22f6311451d08724d7a50c9d23e1da6abf0f (diff)
downloadchromium_src-e66ce87932cfe85a770e11086b3f2054ab42839e.zip
chromium_src-e66ce87932cfe85a770e11086b3f2054ab42839e.tar.gz
chromium_src-e66ce87932cfe85a770e11086b3f2054ab42839e.tar.bz2
Handle backslashes when resolving relative URLs on data URLs.
This was causing an assertion failure. The problem was that the path parsing was treating backslash as a path separator/terminator, but the relative URL resolving code did not. The reason is that the relative URL code assumed the input is canonicalized already. This is true in normal cases but not when the relative URLs are non-standard like "data:". BUG=456148 Review URL: https://codereview.chromium.org/934733005 Cr-Commit-Position: refs/heads/master@{#316732}
Diffstat (limited to 'url/url_canon_relative.cc')
-rw-r--r--url/url_canon_relative.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/url/url_canon_relative.cc b/url/url_canon_relative.cc
index 9436245..06ca99c 100644
--- a/url/url_canon_relative.cc
+++ b/url/url_canon_relative.cc
@@ -170,8 +170,8 @@ bool DoIsRelativeURL(const char* base,
// up until and including the last slash. There should be a slash in the
// range, if not, nothing will be copied.
//
-// The input is assumed to be canonical, so we search only for exact slashes
-// and not backslashes as well. We also know that it's ASCII.
+// For stardard URLs the input should be canonical, but when resolving relative
+// URLs on a non-standard base (like "data:") the input can be anything.
void CopyToLastSlash(const char* spec,
int begin,
int end,
@@ -179,7 +179,7 @@ void CopyToLastSlash(const char* spec,
// Find the last slash.
int last_slash = -1;
for (int i = end - 1; i >= begin; i--) {
- if (spec[i] == '/') {
+ if (spec[i] == '/' || spec[i] == '\\') {
last_slash = i;
break;
}