diff mbox series

[FFmpeg-devel,07/10] lavf/hls: treat fs: the same way as file:.

Message ID 20210727144813.452917-8-george@nsup.org
State New
Headers show
Series [FFmpeg-devel,01/10] lavu/internal: add hex to int functions. | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Nicolas George July 27, 2021, 2:48 p.m. UTC
Signed-off-by: Nicolas George <george@nsup.org>
---
 libavformat/hls.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 3c1b80f60c..e1928b6db3 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -646,7 +646,7 @@  static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
         return AVERROR_INVALIDDATA;
 
     // only http(s) & file are allowed
-    if (av_strstart(proto_name, "file", NULL)) {
+    if (av_strstart(proto_name, "file", NULL) || av_strstart(proto_name, "fs", NULL)) {
         if (strcmp(c->allowed_extensions, "ALL") && !av_match_ext(url, c->allowed_extensions)) {
             av_log(s, AV_LOG_ERROR,
                 "Filename extension of \'%s\' is not a common multimedia extension, blocked for security reasons.\n"
@@ -667,8 +667,10 @@  static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
         ;
     else if (av_strstart(url, "data", NULL) && !strncmp(proto_name, url + 5, strlen(proto_name)) && url[5 + strlen(proto_name)] == ':')
         ;
-    else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5))
+    else if ((strcmp(proto_name, "file") && strcmp(proto_name, "fs")) ||
+             !strncmp(url, "file,", 5) || !strncmp(url, "fs,", 3)) {
         return AVERROR_INVALIDDATA;
+    }
 
     av_dict_copy(&tmp, *opts, 0);
     av_dict_copy(&tmp, opts2, 0);