summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/httplive/M3UParser.cpp
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2014-07-14 09:35:25 -0700
committerSteve Kondik <shade@chemlab.org>2014-07-18 21:08:15 +0000
commitdd3fe99a300dc91be5160d05db2660143a97dc3f (patch)
tree8fddb5cbd46f90cca65abbca950fed9289d4357d /media/libstagefright/httplive/M3UParser.cpp
parentef124fc730cd55bc01690a5dfdca93de672ce768 (diff)
downloadframeworks_av-dd3fe99a300dc91be5160d05db2660143a97dc3f.tar.gz
frameworks_av-dd3fe99a300dc91be5160d05db2660143a97dc3f.tar.bz2
frameworks_av-dd3fe99a300dc91be5160d05db2660143a97dc3f.zip
Fix M3UParser relative path handling.
Bug: 16017037 Change-Id: Ibfff99387fb5b3e721144a2b3f9174092d785137
Diffstat (limited to 'media/libstagefright/httplive/M3UParser.cpp')
-rw-r--r--media/libstagefright/httplive/M3UParser.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/media/libstagefright/httplive/M3UParser.cpp b/media/libstagefright/httplive/M3UParser.cpp
index f211bc8a20..629d6bcc02 100644
--- a/media/libstagefright/httplive/M3UParser.cpp
+++ b/media/libstagefright/httplive/M3UParser.cpp
@@ -398,6 +398,8 @@ static bool MakeURL(const char *baseURL, const char *url, AString *out) {
// Base URL must be absolute
return false;
}
+ const size_t schemeEnd = (strstr(baseURL, "//") - baseURL) + 2;
+ CHECK(schemeEnd == 7 || schemeEnd == 8);
if (!strncasecmp("http://", url, 7) || !strncasecmp("https://", url, 8)) {
// "url" is already an absolute URL, ignore base URL.
@@ -442,7 +444,7 @@ static bool MakeURL(const char *baseURL, const char *url, AString *out) {
// Check whether the found slash actually is part of the path
// and not part of the "http://".
- if (end > 6) {
+ if (end >= schemeEnd) {
out->setTo(baseURL, end);
} else {
out->setTo(baseURL);