Message ID | 20170105004056.14716-1-lq@chinaffmpeg.org |
---|---|
State | New |
Headers | show |
On Thu, Jan 05, 2017 at 08:40:56AM +0800, Steven Liu wrote: > 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. hmm i think: this is wrong: hls->vtt_oformat = av_guess_format("webvtt", NULL, NULL); if (!hls->oformat) { above checks the wrong value then vtt_oformat should be non null [...]
2017-01-06 2:00 GMT+08:00 Michael Niedermayer <michael@niedermayer.cc>: > On Thu, Jan 05, 2017 at 08:40:56AM +0800, Steven Liu wrote: > > 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. > > hmm > > i think: > this is wrong: > hls->vtt_oformat = av_guess_format("webvtt", NULL, NULL); > if (!hls->oformat) { > above checks the wrong value > > then vtt_oformat should be non null > Ok, ignore this patch please :-D > > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Breaking DRM is a little like attempting to break through a door even > though the window is wide open and the only thing in the house is a bunch > of things you dont want and which you would get tomorrow for free anyway > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > >
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);
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 <lq@chinaffmpeg.org> --- libavformat/hlsenc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)