From 8e77c3846e91b1af9df4084736257d9899156eef Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 16 Apr 2012 16:27:08 +0200 Subject: [PATCH] dcadec: fix global array overread. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- libavcodec/dca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/dca.c b/libavcodec/dca.c index d9fafbad01..1d0cf3a4ec 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -805,7 +805,7 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index) "Invalid channel mode %d\n", am); return AVERROR_INVALIDDATA; } - for (j = base_channel; j < s->prim_channels; j++) { + for (j = base_channel; j < FFMIN(s->prim_channels, FF_ARRAY_ELEMS(dca_default_coeffs[am])); j++) { s->downmix_coef[j][0] = dca_default_coeffs[am][j][0]; s->downmix_coef[j][1] = dca_default_coeffs[am][j][1]; }