CID: 1323076
Passing null pointer loc to avformat_new_stream, which dereferences it
 fix: because the vtt_oc maybe have not value, so fix it.

Signed-off-by: Steven Liu <l...@chinaffmpeg.org>
---
 libavformat/hlsenc.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 808a797..2a53908 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -406,10 +406,16 @@ static int hls_mux_init(AVFormatContext *s)
     for (i = 0; i < s->nb_streams; i++) {
         AVStream *st;
         AVFormatContext *loc;
-        if (s->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE)
-            loc = vtt_oc;
-        else
+        if (s->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) {
+            if (vtt_oc) {
+                loc = vtt_oc;
+            } else {
+                av_log(s, AV_LOG_WARNING, "No VTT file found, so just can not 
use it\n");
+                loc = oc;
+            }
+        } else {
             loc = oc;
+        }
 
         if (!(st = avformat_new_stream(loc, NULL)))
             return AVERROR(ENOMEM);
-- 
2.10.1.382.ga23ca1b.dirty



_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to