Browse code

Check for out of bound bands limit in mpc v8 decoder.

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

Laurent Aimar authored on 2011/09/25 20:43:38
Showing 1 changed files
... ...
@@ -127,6 +127,8 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx)
127 127
 
128 128
     skip_bits(&gb, 3);//sample rate
129 129
     c->maxbands = get_bits(&gb, 5) + 1;
130
+    if (c->maxbands >= BANDS)
131
+        return AVERROR_INVALIDDATA;
130 132
     channels = get_bits(&gb, 4) + 1;
131 133
     if (channels > 2) {
132 134
         av_log_missing_feature(avctx, "Multichannel MPC SV8", 1);
... ...
@@ -260,6 +262,8 @@ static int mpc8_decode_frame(AVCodecContext * avctx,
260 260
         maxband = c->last_max_band + get_vlc2(gb, band_vlc.table, MPC8_BANDS_BITS, 2);
261 261
         if(maxband > 32) maxband -= 33;
262 262
     }
263
+    if(maxband > c->maxbands)
264
+        return AVERROR_INVALIDDATA;
263 265
     c->last_max_band = maxband;
264 266
 
265 267
     /* read subband indexes */