summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2017-03-14 09:15:29 +0000
committerLuca Barbato <lu_zero@gentoo.org>2017-03-21 12:08:49 +0100
commite245d4f45ca5e2b97daef5944d63323c07d545bc (patch)
tree0be318afea05f7fbab4b80c6b88e60602c915a0d /libavcodec
parent3df77b58e35a30ed550f99936a308f6bd2f47a20 (diff)
dca: Validate the channel map
Having a mismatch between the number of channels in the stream and those in the channel map will lead to a segfault or worse. Bug-Id: 1016 CC: libav-stable@libav.org Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dcadec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index cd4432368c..af26dceafd 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -1297,6 +1297,9 @@ static int set_channel_layout(AVCodecContext *avctx, int channels, int num_core_
s->channel_order_tab = ff_dca_channel_reorder_nolfe[s->amode];
}
+ if (channels < ff_dca_channels[s->amode])
+ return AVERROR_INVALIDDATA;
+
if (channels > !!s->lfe &&
s->channel_order_tab[channels - 1 - !!s->lfe] < 0)
return AVERROR_INVALIDDATA;