[FFmpeg-cvslog] af_aresample: allocate at least 1 sample buffer. Fix null ptr dereference.
Michael Niedermayer
git at videolan.org
Mon Nov 19 16:28:52 CET 2012
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Nov 19 15:55:23 2012 +0100| [c44a028e19c89671dbd614c283f7e5fe2f555139] | committer: Michael Niedermayer
af_aresample: allocate at least 1 sample buffer. Fix null ptr dereference.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c44a028e19c89671dbd614c283f7e5fe2f555139
---
libavfilter/af_aresample.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c
index 53c5dcd..7201d37 100644
--- a/libavfilter/af_aresample.c
+++ b/libavfilter/af_aresample.c
@@ -174,12 +174,11 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamplesref)
{
AResampleContext *aresample = inlink->dst->priv;
const int n_in = insamplesref->audio->nb_samples;
- int n_out = n_in * aresample->ratio * 2 ;
+ int n_out = FFMAX(n_in * aresample->ratio * 2, 1);
AVFilterLink *const outlink = inlink->dst->outputs[0];
AVFilterBufferRef *outsamplesref = ff_get_audio_buffer(outlink, AV_PERM_WRITE, n_out);
int ret;
-
avfilter_copy_buffer_ref_props(outsamplesref, insamplesref);
outsamplesref->format = outlink->format;
outsamplesref->audio->channel_layout = outlink->channel_layout;
More information about the ffmpeg-cvslog
mailing list