diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2008-06-03 23:34:26 +0000 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2008-06-03 23:34:26 +0000 |
commit | 31bc6b454994d7b7a99a30876c0427c07c5885e3 (patch) | |
tree | dea78b7a7ab56a72570027376a7a4ccbf23765be /libavcodec/ac3.c | |
parent | d326dd97976a11e44db9b0ec18ad0050c147b04f (diff) | |
download | ffmpeg-31bc6b454994d7b7a99a30876c0427c07c5885e3.tar.gz |
prevent crash when dba params are invalid
Originally committed as revision 13653 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3.c')
-rw-r--r-- | libavcodec/ac3.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c index a1415a570c..132ea0f8b5 100644 --- a/libavcodec/ac3.c +++ b/libavcodec/ac3.c @@ -157,8 +157,8 @@ void ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd, if (dba_mode == DBA_REUSE || dba_mode == DBA_NEW) { int band, seg, delta; band = 0; - for (seg = 0; seg < dba_nsegs; seg++) { - band += dba_offsets[seg]; + for (seg = 0; seg < FFMIN(8, dba_nsegs); seg++) { + band = FFMIN(49, band + dba_offsets[seg]); if (dba_values[seg] >= 4) { delta = (dba_values[seg] - 3) << 7; } else { |