lavfi: add missing check in avfilter_filter_samples()
authorStefano Sabatini <stefasab@gmail.com>
Tue, 27 Dec 2011 14:15:02 +0000 (15:15 +0100)
committerStefano Sabatini <stefasab@gmail.com>
Tue, 27 Dec 2011 14:21:00 +0000 (15:21 +0100)
Avoid out-of-buffer data access when nb_channels is 8.

libavfilter/avfilter.c

index b4c9fa6..97f78e4 100644 (file)
@@ -678,7 +678,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);