diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-02-29 18:09:51 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-02-29 21:18:54 +0100 |
commit | d6bc273bac45d6c28e5ec00103268a6fba16f304 (patch) | |
tree | c8e9c69f25988266a38904c190de21f3b716c4de /libavcodec/dca.c | |
parent | 33b9fe562a307629d8db61edcf729c4cb8f78413 (diff) | |
download | ffmpeg-d6bc273bac45d6c28e5ec00103268a6fba16f304.tar.gz |
dca: Check LFEScaleIndex.
Its not clear from the spec what to do with values larger than 127
so iam opting for the safe side and ask for a sample.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dca.c')
-rw-r--r-- | libavcodec/dca.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/dca.c b/libavcodec/dca.c index 4ac291f8af..562eb94ee2 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -817,6 +817,7 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index) /* Low frequency effect data */ if (!base_channel && s->lfe) { + int quant7; /* LFE samples */ int lfe_samples = 2 * s->lfe * (4 + block_index); int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]); @@ -828,7 +829,12 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index) } /* Scale factor index */ - s->lfe_scale_factor = scale_factor_quant7[get_bits(&s->gb, 8)]; + quant7 = get_bits(&s->gb, 8); + if (quant7 > 127) { + av_log_ask_for_sample(s->avctx, "LFEScaleIndex larger than 127\n"); + return AVERROR_INVALIDDATA; + } + s->lfe_scale_factor = scale_factor_quant7[quant7]; /* Quantization step size * scale factor */ lfe_scale = 0.035 * s->lfe_scale_factor; |