[FFmpeg-cvslog] dcadec: fix global array overread.

Michael Niedermayer git at videolan.org
Mon Apr 16 17:02:53 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Apr 16 16:27:08 2012 +0200| [8e77c3846e91b1af9df4084736257d9899156eef] | committer: Michael Niedermayer

dcadec: fix global array overread.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8e77c3846e91b1af9df4084736257d9899156eef
---

 libavcodec/dca.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/dca.c b/libavcodec/dca.c
index d9fafba..1d0cf3a 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];
             }



More information about the ffmpeg-cvslog mailing list