Commit 7c9d7480 authored by alexc's avatar alexc

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.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@22044 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent de438917
...@@ -715,6 +715,10 @@ static int decode_band_types(AACContext *ac, enum BandType band_type[120], ...@@ -715,6 +715,10 @@ static int decode_band_types(AACContext *ac, enum BandType band_type[120],
while ((sect_len_incr = get_bits(gb, bits)) == (1 << bits) - 1) while ((sect_len_incr = get_bits(gb, bits)) == (1 << bits) - 1)
sect_end += sect_len_incr; sect_end += sect_len_incr;
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) { if (sect_end > ics->max_sfb) {
av_log(ac->avccontext, AV_LOG_ERROR, av_log(ac->avccontext, AV_LOG_ERROR,
"Number of bands (%d) exceeds limit (%d).\n", "Number of bands (%d) exceeds limit (%d).\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment