mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/hls: forbid all protocols except http(s) & file
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7145e80b4f
)
Conflicts:
libavformat/hls.c
This commit is contained in:
parent
a7dea6f2cd
commit
e183075dc1
|
@ -927,6 +927,12 @@ static int open_input(HLSContext *c, struct playlist *pls)
|
||||||
seg->url, seg->url_offset, pls->index);
|
seg->url, seg->url_offset, pls->index);
|
||||||
|
|
||||||
if (seg->key_type == KEY_NONE) {
|
if (seg->key_type == KEY_NONE) {
|
||||||
|
const char *proto_name = avio_find_protocol_name(seg->url);
|
||||||
|
if (!av_strstart(proto_name, "http", NULL) && !av_strstart(proto_name, "file", NULL)) {
|
||||||
|
ret = AVERROR_INVALIDDATA;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ffurl_open(&pls->input, seg->url, AVIO_FLAG_READ,
|
ret = ffurl_open(&pls->input, seg->url, AVIO_FLAG_READ,
|
||||||
&pls->parent->interrupt_callback, &opts);
|
&pls->parent->interrupt_callback, &opts);
|
||||||
|
|
||||||
|
@ -934,6 +940,11 @@ static int open_input(HLSContext *c, struct playlist *pls)
|
||||||
char iv[33], key[33], url[MAX_URL_SIZE];
|
char iv[33], key[33], url[MAX_URL_SIZE];
|
||||||
if (strcmp(seg->key, pls->key_url)) {
|
if (strcmp(seg->key, pls->key_url)) {
|
||||||
URLContext *uc;
|
URLContext *uc;
|
||||||
|
const char *proto_name = avio_find_protocol_name(seg->key);
|
||||||
|
if (!av_strstart(proto_name, "http", NULL) && !av_strstart(proto_name, "file", NULL)) {
|
||||||
|
ret = AVERROR_INVALIDDATA;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
if (ffurl_open(&uc, seg->key, AVIO_FLAG_READ,
|
if (ffurl_open(&uc, seg->key, AVIO_FLAG_READ,
|
||||||
&pls->parent->interrupt_callback, &opts2) == 0) {
|
&pls->parent->interrupt_callback, &opts2) == 0) {
|
||||||
if (ffurl_read_complete(uc, pls->key, sizeof(pls->key))
|
if (ffurl_read_complete(uc, pls->key, sizeof(pls->key))
|
||||||
|
|
Loading…
Reference in New Issue