summaryrefslogtreecommitdiffstats
path: root/libavcodec/escape124.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-06-24 19:23:02 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-06-25 22:58:45 +0200
commit6677c98626489edfdb4b49b4f66ca91867768a9f (patch)
tree4f941741b1c8987bf047827fc2e379372f59ac13 /libavcodec/escape124.c
parente7c0b44e747b4ccd5d682cd7e61d4bdd154434b1 (diff)
downloadffmpeg-streaming-6677c98626489edfdb4b49b4f66ca91867768a9f.zip
ffmpeg-streaming-6677c98626489edfdb4b49b4f66ca91867768a9f.tar.gz
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>
Diffstat (limited to 'libavcodec/escape124.c')
-rw-r--r--libavcodec/escape124.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c
index eb051eb..14f9396 100644
--- a/libavcodec/escape124.c
+++ b/libavcodec/escape124.c
@@ -221,7 +221,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);
OpenPOWER on IntegriCloud