]> git.sesse.net Git - ffmpeg/commitdiff
lavfi/avcodec: check that injected avframes use a supported channel layout
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 10 Nov 2012 20:44:20 +0000 (21:44 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 10 Nov 2012 20:45:34 +0000 (21:45 +0100)
This fixes out of array accesses.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavfilter/avcodec.c

index feaf641ccbbb8a381b00f805fcaf8d47966a9f05..c9c8f3c1c193b8ca6093545e2579307c365c2bec 100644 (file)
@@ -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);