aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Cadhalpun <andreas.cadhalpun@googlemail.com>2015-06-10 00:12:38 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-07-28 02:33:56 +0200
commit3c99f8b4ada2076d40e01a14f125f69e3fcbe10a (patch)
tree34ed611d8791b262522a8d9a3f4358197d67de10
parentf5a73058b0f26133bb366f8644711563db76fb74 (diff)
downloadffmpeg-3c99f8b4ada2076d40e01a14f125f69e3fcbe10a.tar.gz
takdec: ensure chan2 is a valid channel index
If chan2 is not smaller than the number of channels, it can cause segmentation faults due to dereferencing a NULL pointer. Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 05c57ba2f42324da2fdc93d83d65bb68dd637613) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/takdec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c
index 5810a01c24..614385803d 100644
--- a/libavcodec/takdec.c
+++ b/libavcodec/takdec.c
@@ -799,6 +799,12 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
if (s->mcdparams[i].present) {
s->mcdparams[i].index = get_bits(gb, 2);
s->mcdparams[i].chan2 = get_bits(gb, 4);
+ if (s->mcdparams[i].chan2 >= avctx->channels) {
+ av_log(avctx, AV_LOG_ERROR,
+ "invalid channel 2 (%d) for %d channel(s)\n",
+ s->mcdparams[i].chan2, avctx->channels);
+ return AVERROR_INVALIDDATA;
+ }
if (s->mcdparams[i].index == 1) {
if ((nbit == s->mcdparams[i].chan2) ||
(ch_mask & 1 << s->mcdparams[i].chan2))