]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/hcadec: Check total_band_count against imdct_in size
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 30 Jun 2020 19:32:53 +0000 (21:32 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 2 Jul 2020 15:18:35 +0000 (17:18 +0200)
Fixes: index 128 out of bounds for type 'float [128]'
Fixes: 23465/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCA_fuzzer-5089866596745216
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/hcadec.c

index 28e7d07cec60a780947b4a5a5fc1a287cf34dbe4..11cb157277aba0d3e40dc720b9731e64d4efb3bc 100644 (file)
@@ -157,6 +157,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
     } else
         return AVERROR_INVALIDDATA;
 
+    if (c->total_band_count > FF_ARRAY_ELEMS(c->ch->imdct_in))
+        return AVERROR_INVALIDDATA;
+
+
     while (get_bits_left(gb) >= 32) {
         chunk = get_bits_long(gb, 32);
         if (chunk == MKBETAG('v', 'b', 'r', 0)) {