[FFmpeg-devel] [PATCH 1/5] avcodec/sonic: Check for overread

Michael Niedermayer michael at niedermayer.cc
Sat Sep 19 22:31:05 EEST 2020


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 at niedermayer.cc>
---
 libavcodec/sonic.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
index fa4ecc3a7a..31c7d78b0c 100644
--- a/libavcodec/sonic.c
+++ b/libavcodec/sonic.c
@@ -1033,6 +1033,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);
-- 
2.17.1



More information about the ffmpeg-devel mailing list