avcodec/hq_hqa: Check remaining input bits in hqa_decode_mb()
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 20 Aug 2018 20:53:32 +0000 (22:53 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 25 Aug 2018 19:50:17 +0000 (21:50 +0200)
Fixes: Timeout
Fixes: 9634/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQ_HQA_fuzzer-6267852259590144

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/hq_hqa.c

index f88ad7d..ec9da3e 100644 (file)
@@ -181,6 +181,9 @@ static int hqa_decode_mb(HQContext *c, AVFrame *pic, int qgroup,
     int flag = 0;
     int i, ret, cbp;
 
+    if (get_bits_left(gb) < 1)
+        return AVERROR_INVALIDDATA;
+
     cbp = get_vlc2(gb, c->hqa_cbp_vlc.table, 5, 1);
 
     for (i = 0; i < 12; i++)