[FFmpeg-cvslog] dcaenc: fix out of array read

Michael Niedermayer git at videolan.org
Fri May 11 03:38:43 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri May 11 03:33:59 2012 +0200| [940be96540ee58e65b3730665b32819dda8d8d32] | committer: Michael Niedermayer

dcaenc: fix out of array read

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

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

 libavcodec/dcaenc.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
index d6efd25..f0b6f81 100644
--- a/libavcodec/dcaenc.c
+++ b/libavcodec/dcaenc.c
@@ -503,13 +503,13 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
     samples = (const int16_t *)frame->data[0];
     for (i = 0; i < PCM_SAMPLES; i ++) { /* i is the decimated sample number */
         for (channel = 0; channel < c->prim_channels + 1; channel++) {
-            /* Get 32 PCM samples */
-            for (k = 0; k < 32; k++) { /* k is the sample number in a 32-sample block */
-                c->pcm[k] = samples[avctx->channels * (32 * i + k) + channel] << 16;
-            }
-            /* Put subband samples into the proper place */
             real_channel = c->channel_order_tab[channel];
             if (real_channel >= 0) {
+                /* Get 32 PCM samples */
+                for (k = 0; k < 32; k++) { /* k is the sample number in a 32-sample block */
+                    c->pcm[k] = samples[avctx->channels * (32 * i + k) + channel] << 16;
+                }
+                /* Put subband samples into the proper place */
                 qmf_decompose(c, c->pcm, &c->subband[i][real_channel][0], real_channel);
             }
         }



More information about the ffmpeg-cvslog mailing list