Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@videolan.org>2011-10-01 02:45:05 +0400
committerMichael Niedermayer <michaelni@gmx.at>2011-10-01 23:03:45 +0400
commitb08df314dca6946ed644caacb9d3a533a054c0f6 (patch)
treebb0e3f4d3ba2568b6f6709d99a769485a44d2e93 /libavcodec/qdm2.c
parente0fb22cea9056afd30848d9d51e92f5ae24ea0f6 (diff)
Check for out of bound writes in the QDM2 decoder.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 4a7876c6e4e62e94d51e364ba99aae4da7671238)
Diffstat (limited to 'libavcodec/qdm2.c')
-rw-r--r--libavcodec/qdm2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index a6192e91c2..1665c8daed 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -1799,6 +1799,8 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
avctx->channels = s->nb_channels = s->channels = AV_RB32(extradata);
extradata += 4;
+ if (s->channels > MPA_MAX_CHANNELS)
+ return AVERROR_INVALIDDATA;
avctx->sample_rate = AV_RB32(extradata);
extradata += 4;
@@ -1820,6 +1822,8 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
// something like max decodable tones
s->group_order = av_log2(s->group_size) + 1;
s->frame_size = s->group_size / 16; // 16 iterations per super block
+ if (s->frame_size > FF_ARRAY_ELEMS(s->output_buffer) / 2)
+ return AVERROR_INVALIDDATA;
s->sub_sampling = s->fft_order - 7;
s->frequency_range = 255 / (1 << (2 - s->sub_sampling));