[libav-commits] ac3: Check the array bound before dereferencing

Luca Barbato git at libav.org
Wed Jun 8 13:43:43 CEST 2016


Module: libav
Branch: release/11
Commit: ae0d692eb0114f6b7edead0ff671885e0e03bb86

Author:    Luca Barbato <lu_zero at gentoo.org>
Committer: Sean McGovern <gseanmcg at gmail.com>
Date:      Thu May 26 02:41:25 2016 +0200

ac3: Check the array bound before dereferencing

CC: libav-stable at libav.org

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

---

 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 79b4946..03dfd7b 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 libav-commits mailing list