aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-11 18:39:33 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-14 12:20:16 +0200
commitaf52a28f4dd2cd536f066e630d618a0405a37b93 (patch)
treeeb42c7f6a866cbe52742e3b9e4188835d3f3384d /libavcodec
parent0a75880b648e4be9486f44d2e27e42f86cd5bb91 (diff)
downloadffmpeg-af52a28f4dd2cd536f066e630d618a0405a37b93.tar.gz
avcodec/cllc: Check num_bits
Fixes: runtime error: shift exponent -2 is negative Fixes: 1479/clusterfuzz-testcase-minimized-6638493360979968 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 2bfd0a97587d26c0c39413a6291ccc66e4a928d0) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/cllc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/cllc.c b/libavcodec/cllc.c
index 386b2f0ed2..24fa168e36 100644
--- a/libavcodec/cllc.c
+++ b/libavcodec/cllc.c
@@ -55,6 +55,13 @@ static int read_code_table(CLLCContext *ctx, GetBitContext *gb, VLC *vlc)
num_lens = get_bits(gb, 5);
+ if (num_lens > VLC_BITS * VLC_DEPTH) {
+ vlc->table = NULL;
+
+ av_log(ctx->avctx, AV_LOG_ERROR, "To long VLCs %d\n", num_lens);
+ return AVERROR_INVALIDDATA;
+ }
+
for (i = 0; i < num_lens; i++) {
num_codes = get_bits(gb, 9);
num_codes_sum += num_codes;