avcodec/dcadec: Check nchans

Fixes CID1239110

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a6a45774d0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-05-14 20:49:25 +02:00
parent 25d50ad814
commit 3da0395b34
1 changed files with 8 additions and 0 deletions

View File

@ -226,6 +226,14 @@ static int dca_parse_audio_coding_header(DCAContext *s, int base_channel,
}
nchans = get_bits(&s->gb, 3) + 1;
if (xxch && nchans >= 3) {
av_log(s->avctx, AV_LOG_ERROR, "nchans %d is too large\n", nchans);
return AVERROR_INVALIDDATA;
} else if (nchans + base_channel > DCA_PRIM_CHANNELS_MAX) {
av_log(s->avctx, AV_LOG_ERROR, "channel sum %d + %d is too large\n", nchans, base_channel);
return AVERROR_INVALIDDATA;
}
s->total_channels = nchans + base_channel;
s->prim_channels = s->total_channels;