diff mbox series

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

Message ID 20200919193109.31148-1-michael@niedermayer.cc
State Accepted
Commit eeabdef1bf96cdecf80aeb8d0478d008457b048c
Headers show
Series [FFmpeg-devel,1/5] avcodec/sonic: Check for overread
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Michael Niedermayer Sept. 19, 2020, 7:31 p.m. UTC
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 | 3 +++
 1 file changed, 3 insertions(+)

Comments

Michael Niedermayer Oct. 15, 2020, 8:44 p.m. UTC | #1
On Sat, Sep 19, 2020 at 09:31:05PM +0200, Michael Niedermayer wrote:
> 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 | 3 +++
>  1 file changed, 3 insertions(+)

will apply patchset

[...]
diff mbox series

Patch

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);