aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-09-09 20:30:32 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-15 12:25:46 +0100
commit29f07606b6b13739e8a19dc8eeab183fdde74ce8 (patch)
tree5820331d5b81d546462b194dd364da5bd17c8545 /libavcodec
parent8ca3bf37abde85786dc21b154743eb21ab01bd5a (diff)
downloadffmpeg-29f07606b6b13739e8a19dc8eeab183fdde74ce8.tar.gz
avcodec/g2meet: Check for end of input in jpg_decode_block()
Fixes: Timeout (100sec -> 0.7sec) Fixes: 8668/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G2M_fuzzer-5174143888130048 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 61dd2e07be7ca636e1d3d868f90dde1b10985f4c) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/g2meet.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c
index 19e1c130ce..731d29a5d4 100644
--- a/libavcodec/g2meet.c
+++ b/libavcodec/g2meet.c
@@ -244,6 +244,9 @@ static int jpg_decode_block(JPGContext *c, GetBitContext *gb,
const int is_chroma = !!plane;
const uint8_t *qmat = is_chroma ? chroma_quant : luma_quant;
+ if (get_bits_left(gb) < 1)
+ return AVERROR_INVALIDDATA;
+
c->bdsp.clear_block(block);
dc = get_vlc2(gb, c->dc_vlc[is_chroma].table, 9, 3);
if (dc < 0)