]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/sonic: Check for overread
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 19 Sep 2020 09:29:01 +0000 (11:29 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 15 Oct 2020 20:53:56 +0000 (22:53 +0200)
Fixes: Timeout (too long -> 1.3 sec)
Fixes: 24358/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5107284099989504
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/sonic.c

index e1d37f878089567205e832901621914643603f88..0d4891ebf4735cfc4d6f24d3bccae5f0117f59dc 100644 (file)
@@ -1031,6 +1031,9 @@ static int sonic_decode_frame(AVCodecContext *avctx,
     {
         int x = ch;
 
+        if (c.overread > MAX_OVERREAD)
+            return AVERROR_INVALIDDATA;
+
         predictor_init_state(s->predictor_k, s->predictor_state[ch], s->num_taps);
 
         intlist_read(&c, state, s->coded_samples[ch], s->block_align, 1);