]> git.sesse.net Git - ffmpeg/commitdiff
vmdaudio: validate block type
authorJustin Ruggles <justin.ruggles@gmail.com>
Wed, 23 Feb 2011 18:11:05 +0000 (13:11 -0500)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 26 Feb 2011 02:16:02 +0000 (03:16 +0100)
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 22f893e1c9f9387f0a021f775757130fa48e0180)

libavcodec/vmdav.c

index a528d9119000cbbd0cd903e46665e11d588e0d57..b338da39042f8db3120a01bdc8dc53437da1187e 100644 (file)
@@ -518,6 +518,10 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx,
         return buf_size;
 
     block_type = buf[6];
+    if (block_type < BLOCK_TYPE_AUDIO || block_type > BLOCK_TYPE_SILENCE) {
+        av_log(avctx, AV_LOG_ERROR, "unknown block type: %d\n", block_type);
+        return AVERROR(EINVAL);
+    }
 
     if (block_type == BLOCK_TYPE_AUDIO) {
         /* the chunk contains audio */