]> git.sesse.net Git - ffmpeg/commitdiff
adpcm: Fix crash
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 19 Dec 2011 03:09:23 +0000 (04:09 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 19 Dec 2011 03:09:23 +0000 (04:09 +0100)
Fixes half of Ticket794
Bug found by: Oana Stratulat

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/adpcm.c

index bbc7d1cd273a2c8fae5763025e82e9592d234bbe..e7657945dddc15c9dddb57a7e4a53442e3337f2b 100644 (file)
@@ -818,6 +818,9 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
         /* Each EA ADPCM frame has a 12-byte header followed by 30-byte pieces,
            each coding 28 stereo samples. */
 
         /* Each EA ADPCM frame has a 12-byte header followed by 30-byte pieces,
            each coding 28 stereo samples. */
 
+        if(avctx->channels != 2)
+            return AVERROR_INVALIDDATA;
+
         src += 4; // skip sample count (already read)
 
         current_left_sample   = (int16_t)bytestream_get_le16(&src);
         src += 4; // skip sample count (already read)
 
         current_left_sample   = (int16_t)bytestream_get_le16(&src);