[FFmpeg-cvslog] avcodec/webp: Check available space in loop in decode_entropy_coded_image()
Michael Niedermayer
git at videolan.org
Wed Sep 8 22:44:06 EEST 2021
ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Sun Jul 25 15:50:54 2021 +0200| [671e182cc46e73a0b63c3d1f35efab12405f8ea5] | committer: Michael Niedermayer
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 at niedermayer.cc>
(cherry picked from commit 5e00eab61112c52f27a09fe77d50e6fc508f9c53)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=671e182cc46e73a0b63c3d1f35efab12405f8ea5
---
libavcodec/webp.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index 5a7aebc587..06a4cc04a5 100644
--- a/libavcodec/webp.c
+++ b/libavcodec/webp.c
@@ -627,6 +627,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) {
More information about the ffmpeg-cvslog
mailing list