diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-04-22 03:47:53 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-07-31 02:30:56 +0200 |
commit | 466911f0004a494b46991c193c09c8452ed26dbc (patch) | |
tree | 9823d001ae50985dc484ac936d67c928b6970b32 /libavcodec | |
parent | e3e25777944eaa32847d71e68fd939f22d084f08 (diff) | |
download | ffmpeg-n0.10.8.tar.gz |
wmaprodec: tighter check for num_vec_coeffsn0.10.8
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b21ba20cc83c80fe56192fee3626a8087f37d806)
Conflicts:
libavcodec/wmaprodec.c
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/wmaprodec.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index e4309ad975..e04df49266 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -86,6 +86,7 @@ * subframe in order to reconstruct the output samples. */ +#include "libavutil/avassert.h" #include "libavutil/intfloat.h" #include "libavutil/intreadwrite.h" #include "avcodec.h" @@ -1177,6 +1178,7 @@ static int decode_subframe(WMAProDecodeCtx *s) transmit_coeffs = 1; } + av_assert0(s->subframe_len <= WMAPRO_BLOCK_MAX_SIZE); if (transmit_coeffs) { int step; int quant_step = 90 * s->bits_per_sample >> 4; @@ -1187,10 +1189,11 @@ static int decode_subframe(WMAProDecodeCtx *s) for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; int num_vec_coeffs = get_bits(&s->gb, num_bits) << 2; - if (num_vec_coeffs + offset > FF_ARRAY_ELEMS(s->channel[c].out)) { + if (num_vec_coeffs > s->subframe_len) { av_log(s->avctx, AV_LOG_ERROR, "num_vec_coeffs %d is too large\n", num_vec_coeffs); return AVERROR_INVALIDDATA; } + av_assert0(num_vec_coeffs + offset <= FF_ARRAY_ELEMS(s->channel[c].out)); s->channel[c].num_vec_coeffs = num_vec_coeffs; } } else { |