Browse Source

avcodec/escape124: Check buf_size against num_superblocks

Fixes: Timeout
Fixes: 8722/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ESCAPE124_fuzzer-4843268402577408

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 6677c98626)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n2.8.15
Michael Niedermayer 7 years ago
parent
commit
9bfdb49b74
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      libavcodec/escape124.c

+ 5
- 1
libavcodec/escape124.c View File

@@ -222,7 +222,11 @@ static int escape124_decode_frame(AVCodecContext *avctx,

// This call also guards the potential depth reads for the
// codebook unpacking.
if (get_bits_left(&gb) < 64)
// Check if the amount we will read minimally is available on input.
// The 64 represent the immedeatly next 2 frame_* elements read, the 23/4320
// represent a lower bound of the space needed for skiped superblocks. Non
// skipped SBs need more space.
if (get_bits_left(&gb) < 64 + s->num_superblocks * 23LL / 4320)
return -1;

frame_flags = get_bits_long(&gb, 32);


Loading…
Cancel
Save