]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/smacker: Check remaining bits in SMK_BLK_FULL
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 2 Oct 2020 08:54:31 +0000 (10:54 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 17 Oct 2020 12:36:11 +0000 (14:36 +0200)
Fixes: out of array access
Fixes: 26047/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKER_fuzzer-5083031667474432
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/smacker.c

index 813eb862c0b7b508a4eeea26e5ffd46c79420d87..6b1faec09efff05d089711c5bf23cc20d67a7158 100644 (file)
@@ -448,6 +448,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
         case SMK_BLK_FULL:
             mode = 0;
             if(avctx->codec_tag == MKTAG('S', 'M', 'K', '4')) { // In case of Smacker v4 we have three modes
+                if (get_bits_left(&gb) < 1)
+                    return AVERROR_INVALIDDATA;
                 if(get_bits1(&gb)) mode = 1;
                 else if(get_bits1(&gb)) mode = 2;
             }