From 874c8a17ac9b04fb7ac23d003e54e3662dd23b4e Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Tue, 9 Jul 2013 01:03:13 +0200 Subject: [PATCH 1/2] atrac3: fix error handling decode_tonal_components returns a proper AVERROR. Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org --- libavcodec/atrac3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index bfc26fc027..dbdf77ca25 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -664,8 +664,8 @@ static int decode_channel_sound_unit(ATRAC3Context *q, GetBitContext *gb, snd->num_components = decode_tonal_components(gb, snd->components, snd->bands_coded); - if (snd->num_components == -1) - return -1; + if (snd->num_components < 0) + return snd->num_components; num_subbands = decode_spectrum(gb, snd->spectrum); From 22e76ec635bafdd1d1ec35581a7ac09e69e3c43e Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Tue, 9 Jul 2013 04:20:23 +0200 Subject: [PATCH 2/2] atrac3: set the getbits context the right buffer_end Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org --- libavcodec/atrac3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index dbdf77ca25..cd120e9f6a 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -742,7 +742,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_bits(&q->gb, ptr1, (avctx->block_align - i) * 8); /* Fill the Weighting coeffs delay buffer */ memmove(q->weighting_delay, &q->weighting_delay[2],