lavfi: add missing check in avfilter_filter_samples()
authorStefano Sabatini <stefasab@gmail.com>
Tue, 27 Dec 2011 14:15:02 +0000 (15:15 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 12 Jan 2012 20:52:03 +0000 (21:52 +0100)
Avoid out-of-buffer data access when nb_channels is 8.
(cherry picked from commit ae21776207e8a2bbe268e7c9e203f7599dd87ddb)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavfilter/avfilter.c

index a57677c..d2b4986 100644 (file)
@@ -614,7 +614,7 @@ void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
         link->cur_buf->audio->sample_rate = samplesref->audio->sample_rate;
 
         /* Copy actual data into new samples buffer */
-        for (i = 0; samplesref->data[i]; i++)
+        for (i = 0; samplesref->data[i] && i < 8; i++)
             memcpy(link->cur_buf->data[i], samplesref->data[i], samplesref->linesize[0]);
 
         avfilter_unref_buffer(samplesref);