[FFmpeg-cvslog] avformat/hls: check output string is usable of ff_make_absolute_url

Steven Liu git at videolan.org
Sun Jun 14 22:24:26 EEST 2020


ffmpeg | branch: release/4.3 | Steven Liu <lq at chinaffmpeg.org> | Thu May 28 10:41:26 2020 +0800| [0c37321362a1d359f555cbc65ebcc9770628311e] | committer: Marton Balint

avformat/hls: check output string is usable of ff_make_absolute_url

fix ticket: 8688
should goto failed workflow if cannot get usable string by ff_make_absolute_url

Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
(cherry picked from commit ea1940c6e2ead234f6e563c095bb67d352e3328f)

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

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

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 3e35d157ad..3ca6b90b19 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -311,6 +311,8 @@ static struct playlist *new_playlist(HLSContext *c, const char *url,
         return NULL;
     reset_packet(&pls->pkt);
     ff_make_absolute_url(pls->url, sizeof(pls->url), base, url);
+    if (!pls->url[0])
+        return NULL;
     pls->seek_timestamp = AV_NOPTS_VALUE;
 
     pls->is_id3_timestamped = -1;
@@ -416,6 +418,10 @@ static struct segment *new_init_section(struct playlist *pls,
         ptr = info->uri;
     } else {
         ff_make_absolute_url(tmp_str, sizeof(tmp_str), url_base, info->uri);
+        if (!tmp_str[0]) {
+            av_free(sec);
+            return NULL;
+        }
     }
     sec->url = av_strdup(ptr);
     if (!sec->url) {
@@ -841,6 +847,11 @@ static int parse_playlist(HLSContext *c, const char *url,
 
             if (key_type != KEY_NONE) {
                 ff_make_absolute_url(tmp_str, sizeof(tmp_str), url, key);
+                if (!tmp_str[0]) {
+                    av_free(cur_init_section);
+                    ret = AVERROR_INVALIDDATA;
+                    goto fail;
+                }
                 cur_init_section->key = av_strdup(tmp_str);
                 if (!cur_init_section->key) {
                     av_free(cur_init_section);
@@ -895,6 +906,11 @@ static int parse_playlist(HLSContext *c, const char *url,
 
                 if (key_type != KEY_NONE) {
                     ff_make_absolute_url(tmp_str, sizeof(tmp_str), url, key);
+                    if (!tmp_str[0]) {
+                        ret = AVERROR_INVALIDDATA;
+                        av_free(seg);
+                        goto fail;
+                    }
                     seg->key = av_strdup(tmp_str);
                     if (!seg->key) {
                         av_free(seg);
@@ -906,6 +922,13 @@ static int parse_playlist(HLSContext *c, const char *url,
                 }
 
                 ff_make_absolute_url(tmp_str, sizeof(tmp_str), url, line);
+                if (!tmp_str[0]) {
+                    ret = AVERROR_INVALIDDATA;
+                    if (seg->key)
+                        av_free(seg->key);
+                    av_free(seg);
+                    goto fail;
+                }
                 seg->url = av_strdup(tmp_str);
                 if (!seg->url) {
                     av_free(seg->key);



More information about the ffmpeg-cvslog mailing list