[FFmpeg-cvslog] lavfi/avcodec: check that injected avframes use a supported channel layout

Michael Niedermayer git at videolan.org
Sat Nov 10 22:15:44 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Nov 10 21:44:20 2012 +0100| [47ca2487ae88358a324f620cfb50095d086ed8f5] | committer: Michael Niedermayer

lavfi/avcodec: check that injected avframes use a supported channel layout

This fixes out of array accesses.

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=47ca2487ae88358a324f620cfb50095d086ed8f5
---

 libavfilter/avcodec.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c
index feaf641..c9c8f3c 100644
--- a/libavfilter/avcodec.c
+++ b/libavfilter/avcodec.c
@@ -60,6 +60,10 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src)
     case AVMEDIA_TYPE_AUDIO:
         dst->audio->sample_rate         = src->sample_rate;
         dst->audio->channel_layout      = src->channel_layout;
+        if(src->channels != av_get_channel_layout_nb_channels(src->channel_layout)) {
+            av_log(0, AV_LOG_ERROR, "libavfilter does not support this channel layout\n");
+            return AVERROR(EINVAL);
+        }
         break;
     default:
         return AVERROR(EINVAL);



More information about the ffmpeg-cvslog mailing list