# HG changeset patch # User alexc # Date 1267055812 0 # Node ID 11fb96e945738b617c07d62f3f4b1c10755568b0 # Parent fea25a6f874ef99fa73aa2c7420ab4181300971c 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. diff -r fea25a6f874e -r 11fb96e94573 aac.c --- a/aac.c Wed Feb 24 22:13:20 2010 +0000 +++ b/aac.c Wed Feb 24 23:56:52 2010 +0000 @@ -715,6 +715,10 @@ while ((sect_len_incr = get_bits(gb, bits)) == (1 << bits) - 1) sect_end += sect_len_incr; sect_end += sect_len_incr; + if (get_bits_left(gb) < 0) { + av_log(ac->avccontext, AV_LOG_ERROR, overread_err); + return -1; + } if (sect_end > ics->max_sfb) { av_log(ac->avccontext, AV_LOG_ERROR, "Number of bands (%d) exceeds limit (%d).\n",