]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/g2meet: Check for end of input in jpg_decode_block()
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 9 Sep 2019 18:30:32 +0000 (20:30 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 2 Oct 2019 12:49:04 +0000 (14:49 +0200)
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>
libavcodec/g2meet.c

index 19e1c130ce6e6a67a42e371390f4bdc80e6b61e4..731d29a5d4a78b5750873d7205674fa214669855 100644 (file)
@@ -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)