summaryrefslogtreecommitdiff
path: root/libavcodec/ac3dec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2008-12-08 03:13:20 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2008-12-08 03:13:20 +0000
commit72a6244b5d554d7fdfdeb04c174750c7a2c52f83 (patch)
tree8e9f106f4681f2e6e537e5c01ec7eb51ce835951 /libavcodec/ac3dec.c
parentb9f382c8ef55bd2b1a6821bf060e848deda372f1 (diff)
ac3: detect dba errors and prevent writing past end of array
Originally committed as revision 16034 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3dec.c')
-rw-r--r--libavcodec/ac3dec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 291d8f3ab4..c7c240cdb4 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1133,12 +1133,15 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
if(bit_alloc_stages[ch] > 1) {
/* Compute excitation function, Compute masking curve, and
Apply delta bit allocation */
- ff_ac3_bit_alloc_calc_mask(&s->bit_alloc_params, s->band_psd[ch],
+ if (ff_ac3_bit_alloc_calc_mask(&s->bit_alloc_params, s->band_psd[ch],
s->start_freq[ch], s->end_freq[ch],
s->fast_gain[ch], (ch == s->lfe_ch),
s->dba_mode[ch], s->dba_nsegs[ch],
s->dba_offsets[ch], s->dba_lengths[ch],
- s->dba_values[ch], s->mask[ch]);
+ s->dba_values[ch], s->mask[ch])) {
+ av_log(s->avctx, AV_LOG_ERROR, "error in bit allocation\n");
+ return -1;
+ }
}
if(bit_alloc_stages[ch] > 0) {
/* Compute bit allocation */