[FFmpeg-cvslog] Check for out of bound writes in the QDM2 decoder.

Laurent Aimar git at videolan.org
Sun Nov 6 20:18:53 CET 2011


ffmpeg | branch: release/0.5 | Laurent Aimar <fenrir at videolan.org> | Sat Oct  1 00:45:05 2011 +0200| [3699a46ed7179601740a24bd9975abd2409ebf31] | committer: Michael Niedermayer

Check for out of bound writes in the QDM2 decoder.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 4a7876c6e4e62e94d51e364ba99aae4da7671238)
(cherry picked from commit b08df314dca6946ed644caacb9d3a533a054c0f6)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3699a46ed7179601740a24bd9975abd2409ebf31
---

 libavcodec/qdm2.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index a3373a1..69be061 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -1821,6 +1821,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;
@@ -1843,6 +1845,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));



More information about the ffmpeg-cvslog mailing list