ac3enc: return error if frame+exponent bits are too large instead of using

av_assert2().

This can occur in some very rare cases with low bitrates.
This commit is contained in:
Justin Ruggles 2011-04-15 19:56:42 -04:00
parent 987fe2dc55
commit 4142487d1c
1 changed files with 2 additions and 1 deletions

View File

@ -1052,7 +1052,8 @@ static int cbr_bit_allocation(AC3EncodeContext *s)
int snr_offset, snr_incr;
bits_left = 8 * s->frame_size - (s->frame_bits + s->exponent_bits);
av_assert2(bits_left >= 0);
if (bits_left < 0)
return AVERROR(EINVAL);
snr_offset = s->coarse_snr_offset << 4;