]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/takdec.c
Merge commit '2ecfd451649c7a08cb633635df98e59f7c6e2140'
[ffmpeg] / libavcodec / takdec.c
index a453da81eceefc9170969e34886898f377cd5fb0..422503037623e45f904f73821b0e62915ff5825f 100644 (file)
@@ -801,6 +801,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))