From 8c30425f9d7d5099b9e6cb0a0abd4e0b2fdd5639 Mon Sep 17 00:00:00 2001 From: Lajos Molnar Date: Mon, 14 Jul 2014 09:35:25 -0700 Subject: Fix M3UParser relative path handling. Bug: 16017037 Change-Id: Ibfff99387fb5b3e721144a2b3f9174092d785137 --- media/libstagefright/httplive/M3UParser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/media/libstagefright/httplive/M3UParser.cpp b/media/libstagefright/httplive/M3UParser.cpp index 20c3a76..451bc5f 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); -- cgit v1.1