dcadec: fix reading from prior to an array
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 2 Dec 2012 03:00:50 +0000 (04:00 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 2 Dec 2012 03:01:41 +0000 (04:01 +0100)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/dcadec.c

index 77fe92a..acbabd6 100644 (file)
@@ -2164,6 +2164,11 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
                     continue;
                 }
 
+                if (s->xch_base_channel < 2) {
+                    av_log_ask_for_sample(avctx, "XCh with fewer than 2 base channels is not supported\n");
+                    continue;
+                }
+
                 /* much like core primary audio coding header */
                 dca_parse_audio_coding_header(s, s->xch_base_channel, 0);