Commit a0212ecf authored by Michael Niedermayer's avatar Michael Niedermayer

dcadec: check layout & channel count for consistency.

Fixes out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 4facddd5
...@@ -2249,6 +2249,11 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data, ...@@ -2249,6 +2249,11 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
s->channel_order_tab[channels - 1 - !!s->lfe] < 0) s->channel_order_tab[channels - 1 - !!s->lfe] < 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
if (av_get_channel_layout_nb_channels(avctx->channel_layout) != channels) {
av_log(avctx, AV_LOG_ERROR, "Number of channels %d mismatches layout %d\n", channels, av_get_channel_layout_nb_channels(avctx->channel_layout));
return AVERROR_INVALIDDATA;
}
if (avctx->request_channels == 2 && s->prim_channels > 2) { if (avctx->request_channels == 2 && s->prim_channels > 2) {
channels = 2; channels = 2;
s->output = DCA_STEREO; s->output = DCA_STEREO;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment