[FFmpeg-cvslog] avformat/hls: forbid all protocols except http(s) & file

Maxim Andreev git at videolan.org
Fri Jan 15 17:39:21 CET 2016


ffmpeg | branch: release/2.6 | Maxim Andreev <andreevmaxim at gmail.com> | Wed Jan 13 11:51:12 2016 +0300| [8b93f6676b89d23bc5f6e0f4e0afac469de881b9] | committer: Michael Niedermayer

avformat/hls: forbid all protocols except http(s) & file

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 7145e80b4f78cff5ed5fee04d4c4d53daaa0e077)

Conflicts:

	libavformat/hls.c

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b93f6676b89d23bc5f6e0f4e0afac469de881b9
---

 libavformat/hls.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index af890bd..96bcb36 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -938,6 +938,12 @@ static int open_input(HLSContext *c, struct playlist *pls)
            seg->url, seg->url_offset, pls->index);
 
     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,
                           &pls->parent->interrupt_callback, &opts);
 
@@ -945,6 +951,11 @@ static int open_input(HLSContext *c, struct playlist *pls)
         char iv[33], key[33], url[MAX_URL_SIZE];
         if (strcmp(seg->key, pls->key_url)) {
             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,
                            &pls->parent->interrupt_callback, &opts2) == 0) {
                 if (ffurl_read_complete(uc, pls->key, sizeof(pls->key))



More information about the ffmpeg-cvslog mailing list