avcodec/vc1_block: Check for double escapes
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 15 Aug 2019 16:47:54 +0000 (18:47 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 31 Aug 2019 16:34:05 +0000 (18:34 +0200)
Fixes: out of array read
Fixes: 16331/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3IMAGE_fuzzer-5672735195267072

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/vc1_block.c

index 94184b08733686a47d2729af78a1a2907a5624d5..775e3c516b4295d50d5fd626dfd9a43d0a6908d0 100644 (file)
@@ -526,7 +526,7 @@ static int vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip,
         int escape = decode210(gb);
         if (escape != 2) {
             index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset].table, AC_VLC_BITS, 3);
-            if (index < 0)
+            if (index >= ff_vc1_ac_sizes[codingset] - 1U)
                 return AVERROR_INVALIDDATA;
             run   = vc1_index_decode_table[codingset][index][0];
             level = vc1_index_decode_table[codingset][index][1];