History

Revert "avformat/hls: Check local file extensions"

Michael Niedermayer committed 9 years ago

Commit c0702ab1 parent 10b7adf1 file · +1 −17Browse files

Unified · Split

libavformat/hls.c+1−17
@@ -204,7 +204,6 @@ typedef struct HLSContext { · 203 unmodified lines
204 char *http_proxy; ///< holds the address of the HTTP proxy server204 char *http_proxy; ///< holds the address of the HTTP proxy server
205 AVDictionary *avio_opts;205 AVDictionary *avio_opts;
206 int strict_std_compliance;206 int strict_std_compliance;
207 char *allowed_extensions;
208} HLSContext;207} HLSContext;
209 208
210static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)209static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
@@ -619,19 +618,8 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, · 408 unmodified lines
619 return AVERROR_INVALIDDATA;618 return AVERROR_INVALIDDATA;
620 619
621 // only http(s) & file are allowed620 // only http(s) & file are allowed
622 if (av_strstart(proto_name, "file", NULL)) {621 if (!av_strstart(proto_name, "http", NULL) && !av_strstart(proto_name, "file", NULL))
623 if (strcmp(c->allowed_extensions, "ALL") && !av_match_ext(url, c->allowed_extensions)) {
624 av_log(s, AV_LOG_ERROR,
625 "Filename extension of \'%s\' is not a common multimedia extension, blocked for security reasons.\n"
626 "If you wish to override this adjust allowed_extensions, you can set it to \'ALL\' to allow all\n",
627 url);
628 return AVERROR_INVALIDDATA;
629 }
630 } else if (av_strstart(proto_name, "http", NULL)) {
631 ;
632 } else
633 return AVERROR_INVALIDDATA;622 return AVERROR_INVALIDDATA;
634
635 if (!strncmp(proto_name, url, strlen(proto_name)) && url[strlen(proto_name)] == ':')623 if (!strncmp(proto_name, url, strlen(proto_name)) && url[strlen(proto_name)] == ':')
636 ;624 ;
637 else if (av_strstart(url, "crypto", NULL) && !strncmp(proto_name, url + 7, strlen(proto_name)) && url[7 + strlen(proto_name)] == ':')625 else if (av_strstart(url, "crypto", NULL) && !strncmp(proto_name, url + 7, strlen(proto_name)) && url[7 + strlen(proto_name)] == ':')
@@ -2146,10 +2134,6 @@ static int hls_probe(AVProbeData *p) · 1508 unmodified lines
2146static const AVOption hls_options[] = {2134static const AVOption hls_options[] = {
2147 {"live_start_index", "segment index to start live streams at (negative values are from the end)",2135 {"live_start_index", "segment index to start live streams at (negative values are from the end)",
2148 OFFSET(live_start_index), AV_OPT_TYPE_INT, {.i64 = -3}, INT_MIN, INT_MAX, FLAGS},2136 OFFSET(live_start_index), AV_OPT_TYPE_INT, {.i64 = -3}, INT_MIN, INT_MAX, FLAGS},
2149 {"allowed_extensions", "List of file extensions that hls is allowed to access",
2150 OFFSET(allowed_extensions), AV_OPT_TYPE_STRING,
2151 {.str = "3gp,aac,avi,flac,mkv,m3u8,m4a,m4s,m4v,mpg,mov,mp2,mp3,mp4,mpeg,mpegts,ogg,ogv,oga,ts,vob,wav"},
2152 INT_MIN, INT_MAX, FLAGS},
2153 {NULL}2137 {NULL}
2154};2138};
2155 2139

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t