ac3dec: split out pointer update loop for saftey
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 4 Jan 2013 05:09:43 +0000 (06:09 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 4 Jan 2013 05:20:39 +0000 (06:20 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/ac3dec.c

index ea4a218..567c797 100644 (file)
@@ -1400,8 +1400,9 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
         if (err)
             for (ch = 0; ch < s->out_channels; ch++)
                 memcpy(((float*)s->frame.data[ch]) + AC3_BLOCK_SIZE*blk, output[ch], 1024);
-        for (ch = 0; ch < s->out_channels; ch++) {
+        for (ch = 0; ch < s->out_channels; ch++)
             output[ch] = s->outptr[channel_map[ch]];
+        for (ch = 0; ch < s->out_channels; ch++) {
             if (!ch || channel_map[ch])
                 s->outptr[channel_map[ch]] += AC3_BLOCK_SIZE;
         }