diff options
author | Thilo Borgmann <thilo.borgmann@mail.de> | 2014-09-25 16:10:58 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-09-25 18:03:09 +0200 |
commit | e113692c899f6d0b9e9f4307865d3c0a030fa20c (patch) | |
tree | 4446f2b91a7af9d72131fc397ed3bb3f4126d5a1 /ffmpeg_opt.c | |
parent | ce6e46be72292a748f37af50bfd5001dc5daa0e7 (diff) | |
download | ffmpeg-e113692c899f6d0b9e9f4307865d3c0a030fa20c.tar.gz |
lavu/ffmpeg_opt: Check return value of avcodec_find_encoder().
Prevents a segfault if a stream featuring a known but unavailable codec (like external lib codec) should be opened.
Bug found by: Jonas Geistert <j.geistert@yahoo.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg_opt.c')
-rw-r--r-- | ffmpeg_opt.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 05ab652f1a..4fb6fa36b1 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1623,6 +1623,10 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch AVCodecContext *avctx; codec = avcodec_find_encoder(ic->streams[i]->codec->codec_id); + if (!codec) { + av_log(s, AV_LOG_ERROR, "no encoder found for codec id %i\n", ic->streams[i]->codec->codec_id); + return AVERROR(EINVAL); + } ost = new_output_stream(o, s, codec->type, -1); st = ost->st; avctx = st->codec; |