diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-07-25 15:50:54 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-10-06 13:56:53 +0200 |
commit | 5e2aae4c730f2434bc5264ac7b2418f51ef63c7a (patch) | |
tree | c8f833954600ea075d1a6b326db86e42f5d1aa9e | |
parent | 3dbc3d7aa304f756d5343c219dbd85632df3a1e0 (diff) | |
download | ffmpeg-5e2aae4c730f2434bc5264ac7b2418f51ef63c7a.tar.gz |
avcodec/webp: Check available space in loop in decode_entropy_coded_image()
Fixes: Timeout
Fixes: 35401/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WEBP_fuzzer-5714401821851648
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 5e00eab61112c52f27a09fe77d50e6fc508f9c53)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/webp.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 077bb06f85..5486deee58 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -665,6 +665,9 @@ static int decode_entropy_coded_image(WebPContext *s, enum ImageRole role, while (y < img->frame->height) { int v; + if (get_bits_left(&s->gb) < 0) + return AVERROR_INVALIDDATA; + hg = get_huffman_group(s, img, x, y); v = huff_reader_get_symbol(&hg[HUFF_IDX_GREEN], &s->gb); if (v < NUM_LITERAL_CODES) { |