avcodec/hcadec: Check scale_factors
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 28 Mar 2020 21:04:06 +0000 (22:04 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 31 Mar 2020 18:12:15 +0000 (20:12 +0200)
Fixes: out of array read
Fixes: 21286/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCA_fuzzer-5683183715876864

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/hcadec.c

index 4e3f589..f25d6c3 100644 (file)
@@ -345,6 +345,7 @@ static void unpack(HCAContext *c, ChannelContext *ch,
             } else {
                 factor += delta - half_max;
             }
+            factor = av_clip_uintp2(factor, 6);
 
             ch->scale_factors[i] = factor;
         }