ffmpeg | branch: master | Thilo Borgmann <thilo.borgm...@mail.de> | Thu Sep 25 
16:10:58 2014 +0200| [e113692c899f6d0b9e9f4307865d3c0a030fa20c] | committer: 
Michael Niedermayer

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.geist...@yahoo.de>

Signed-off-by: Michael Niedermayer <michae...@gmx.at>

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

 ffmpeg_opt.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 05ab652..4fb6fa3 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;

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

Reply via email to