Mercurial > libavcodec.hg
comparison aac.c @ 11281:11fb96e94573 libavcodec
aac: Keep decode_band_types() from eating all padding at the end of a buffer.
Due to a shortcoming in the AAC specification, if an all zero buffer is
fed to section data decoding it will never terminate. That means without
a buffer exhaustion check decode_band_types() will consume all input
buffer padding. Worse if a get_bits() implementation that returns zeros
when padding is exhausted is used, the function will never terminate.
The fixes that by added a buffer exhaustion check in the sectioning
decoding loop.
author | alexc |
---|---|
date | Wed, 24 Feb 2010 23:56:52 +0000 |
parents | f5d50932acc0 |
children | a1376a6f9af1 |
comparison
equal
deleted
inserted
replaced
11280:fea25a6f874e | 11281:11fb96e94573 |
---|---|
713 return -1; | 713 return -1; |
714 } | 714 } |
715 while ((sect_len_incr = get_bits(gb, bits)) == (1 << bits) - 1) | 715 while ((sect_len_incr = get_bits(gb, bits)) == (1 << bits) - 1) |
716 sect_end += sect_len_incr; | 716 sect_end += sect_len_incr; |
717 sect_end += sect_len_incr; | 717 sect_end += sect_len_incr; |
718 if (get_bits_left(gb) < 0) { | |
719 av_log(ac->avccontext, AV_LOG_ERROR, overread_err); | |
720 return -1; | |
721 } | |
718 if (sect_end > ics->max_sfb) { | 722 if (sect_end > ics->max_sfb) { |
719 av_log(ac->avccontext, AV_LOG_ERROR, | 723 av_log(ac->avccontext, AV_LOG_ERROR, |
720 "Number of bands (%d) exceeds limit (%d).\n", | 724 "Number of bands (%d) exceeds limit (%d).\n", |
721 sect_end, ics->max_sfb); | 725 sect_end, ics->max_sfb); |
722 return -1; | 726 return -1; |