atrac3: fix buffer size for get_bits.
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 26 Jan 2013 03:27:23 +0000 (04:27 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 26 Jan 2013 03:27:53 +0000 (04:27 +0100)
Fixes out of array reads

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/atrac3.c

index 84c5c11..1e54784 100644 (file)
@@ -740,7 +740,7 @@ static int decode_frame(AVCodecContext *avctx, const uint8_t *databuf,
 
 
         /* set the bitstream reader at the start of the second Sound Unit*/
-        init_get_bits(&q->gb, ptr1, avctx->block_align * 8);
+        init_get_bits8(&q->gb, ptr1, q->decoded_bytes_buffer + avctx->block_align - ptr1);
 
         /* Fill the Weighting coeffs delay buffer */
         memmove(q->weighting_delay, &q->weighting_delay[2],