Browse Source

swr: check channel layouts before using them.

Fixes out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n1.2
Michael Niedermayer 13 years ago
parent
commit
21cd905cd4
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      libswresample/swresample.c

+ 10
- 0
libswresample/swresample.c View File

@@ -265,6 +265,16 @@ av_cold int swr_init(struct SwrContext *s){
return AVERROR(EINVAL);
}

if(av_get_channel_layout_nb_channels(s-> in_ch_layout) > SWR_CH_MAX) {
av_log(s, AV_LOG_WARNING, "Input channel layout 0x%"PRIx64" is invalid or unsupported.\n", s-> in_ch_layout);
s->in_ch_layout = 0;
}

if(av_get_channel_layout_nb_channels(s->out_ch_layout) > SWR_CH_MAX) {
av_log(s, AV_LOG_WARNING, "Output channel layout 0x%"PRIx64" is invalid or unsupported.\n", s->out_ch_layout);
s->out_ch_layout = 0;
}

switch(s->engine){
#if CONFIG_LIBSOXR
extern struct Resampler const soxr_resampler;


Loading…
Cancel
Save