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@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-11-10 21:44:20 +01:00
parent a150bad406
commit 47ca2487ae
1 changed files with 4 additions and 0 deletions

View 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);