[FFmpeg-cvslog] avcodec/ac3enc_template: fix out of array read

Michael Niedermayer git at videolan.org
Fri Nov 14 19:28:35 CET 2014


ffmpeg | branch: release/2.0 | Michael Niedermayer <michaelni at gmx.at> | Sat Sep 27 20:34:44 2014 +0200| [52fd0cda2cdd20d89d3a59401379b7befa998688] | committer: Michael Niedermayer

avcodec/ac3enc_template: fix out of array read

Found-by: Andreas Cadhalpun
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit d85ebea3f3b68ebccfe308fa839fc30fa634e4de)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 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 0389c2e..76d42a2 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