[FFmpeg-cvslog] ac3: Check the array bound before dereferencing

Luca Barbato git at videolan.org
Sun Jun 26 20:23:49 CEST 2016


ffmpeg | branch: release/3.1 | Luca Barbato <lu_zero at gentoo.org> | Thu May 26 02:41:25 2016 +0200| [5264e7ba217b3c0ceae813917134e1ab52573141] | committer: Luca Barbato

ac3: Check the array bound before dereferencing

CC: libav-stable at libav.org

Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

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

 libavcodec/ac3enc_template.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c
index 8febf85..ec8ec4e 100644
--- a/libavcodec/ac3enc_template.c
+++ b/libavcodec/ac3enc_template.c
@@ -260,7 +260,7 @@ static void apply_channel_coupling(AC3EncodeContext *s)
                 energy_cpl = energy[blk][CPL_CH][bnd];
                 energy_ch = energy[blk][ch][bnd];
                 blk1 = blk+1;
-                while (!s->blocks[blk1].new_cpl_coords[ch] && blk1 < s->num_blocks) {
+                while (blk1 < s->num_blocks && !s->blocks[blk1].new_cpl_coords[ch]) {
                     if (s->blocks[blk1].cpl_in_use) {
                         energy_cpl += energy[blk1][CPL_CH][bnd];
                         energy_ch += energy[blk1][ch][bnd];



More information about the ffmpeg-cvslog mailing list