1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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 5e00eab611)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2021-07-25 15:50:54 +02:00
parent d6d46907c6
commit ad3df92f53

View File

@ -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) {