diff options
author | Tim Walker <tdskywalker@gmail.com> | 2013-11-23 18:29:21 +0100 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2013-11-23 21:36:49 +0100 |
commit | 48b24bd2d208ce0f124029ac4c5ac5cb1fca4175 (patch) | |
tree | dbcaaacf4414965aa95edc51accc22a91f17cc31 /libavcodec | |
parent | f187557ab4612776f7f527ecf3d40062975c3e4c (diff) | |
download | ffmpeg-48b24bd2d208ce0f124029ac4c5ac5cb1fca4175.tar.gz |
ac3dec: Fix out-of-array read
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/ac3dec.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index e9ed04045f..7172e6378d 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -1367,8 +1367,6 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, s->out_channels = 2; s->output_mode = AC3_CHMODE_STEREO; } - avctx->channels = s->out_channels; - avctx->channel_layout = avpriv_ac3_channel_layout_tab[s->output_mode]; /* set downmixing coefficients if needed */ if (s->channels != s->out_channels && !((s->output_mode & AC3_OUTPUT_LFEON) && @@ -1380,6 +1378,9 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, return AVERROR_INVALIDDATA; } avctx->channels = s->out_channels; + avctx->channel_layout = avpriv_ac3_channel_layout_tab[s->output_mode & ~AC3_OUTPUT_LFEON]; + if (s->output_mode & AC3_OUTPUT_LFEON) + avctx->channel_layout |= AV_CH_LOW_FREQUENCY; /* set audio service type based on bitstream mode for AC-3 */ avctx->audio_service_type = s->bitstream_mode; |