aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-10-10 18:26:44 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-11 20:18:48 +0100
commit0cdd0486ef0640fe230d66a12e8d5d8b6dc891e8 (patch)
tree4f3d825032e8dfd59cced28c5d8421151348f7cc
parent6996d323a00f5ec23f2998218267af55899a0a3c (diff)
downloadffmpeg-0cdd0486ef0640fe230d66a12e8d5d8b6dc891e8.tar.gz
avcodec/qdmc: Check input space in qdmc_get_vlc()
Fixes: Timeout (125sec -> 0.4sec) Fixes: 18059/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDMC_fuzzer-5656195825664000 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 2c7975fe6f5c734fce9c59e8418c7f2de15a558d) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/qdmc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/qdmc.c b/libavcodec/qdmc.c
index b40edc17cc..6af1c4af57 100644
--- a/libavcodec/qdmc.c
+++ b/libavcodec/qdmc.c
@@ -365,6 +365,8 @@ static int qdmc_get_vlc(GetBitContext *gb, VLC *table, int flag)
{
int v;
+ if (get_bits_left(gb) < 1)
+ return AVERROR_INVALIDDATA;
v = get_vlc2(gb, table->table, table->bits, 1);
if (v < 0)
return AVERROR_INVALIDDATA;