From 5ee05a62f968ef62198188d5c4ac68a1d20fc32d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 8 Dec 2009 14:18:15 +0000 Subject: [PATCH] Check that the buffer size speified to avcodec_encode_audio() is not larger than the actual size. Originally committed as revision 20767 to svn://svn.ffmpeg.org/ffmpeg/trunk --- ffmpeg.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ffmpeg.c b/ffmpeg.c index 03231c7bd0..9de9c3f571 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -728,6 +728,11 @@ static void do_audio_out(AVFormatContext *s, if (coded_bps) size_out = size_out*coded_bps/8; + if(size_out > audio_out_size){ + fprintf(stderr, "Internal error, buffer size too small\n"); + av_exit(1); + } + //FIXME pass ost->sync_opts as AVFrame.pts in avcodec_encode_audio() ret = avcodec_encode_audio(enc, audio_out, size_out, (short *)buftmp);