[SCM] libav/upstream.snapshot: wmapro: check num_vec_coeffs against the actual available buffer

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sat Jul 13 06:29:04 UTC 2013


The following commit has been merged in the upstream.snapshot branch:
commit fbeae4a95188d8042f0ff9f16836d49afa6f44af
Author: Luca Barbato <lu_zero at gentoo.org>
Date:   Fri Jun 28 05:23:21 2013 +0200

    wmapro: check num_vec_coeffs against the actual available buffer
    
    Prevent yet another buffer overwrite.
    
    Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
    CC: libav-stable at libav.org
    (cherry picked from commit 38229362529ed1619d8ebcc81ecde85b23b45895)
    
    Signed-off-by: Reinhard Tartler <siretart at tauware.de>

diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 8fabc3a..eed38f6 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -1124,11 +1124,12 @@ static int decode_subframe(WMAProDecodeCtx *s)
     cur_subwoofer_cutoff = s->subwoofer_cutoffs[s->table_idx];
 
     /** configure the decoder for the current subframe */
+    offset += s->samples_per_frame >> 1;
+
     for (i = 0; i < s->channels_for_cur_subframe; i++) {
         int c = s->channel_indexes_for_cur_subframe[i];
 
-        s->channel[c].coeffs = &s->channel[c].out[(s->samples_per_frame >> 1)
-                                                  + offset];
+        s->channel[c].coeffs = &s->channel[c].out[offset];
     }
 
     s->subframe_len = subframe_len;
@@ -1179,7 +1180,7 @@ 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 > WMAPRO_BLOCK_MAX_SIZE) {
+                if (num_vec_coeffs + offset > FF_ARRAY_ELEMS(s->channel[c].out)) {
                     av_log(s->avctx, AV_LOG_ERROR, "num_vec_coeffs %d is too large\n", num_vec_coeffs);
                     return AVERROR_INVALIDDATA;
                 }

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list