aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-11 18:39:33 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-20 03:41:33 +0200
commitf05cd37d51dfcc7fc30d2cc1b1a0cc13bd527cb3 (patch)
tree1ed628b692b233506f15d45b26eec4a6e31e24ca
parentd6e7a96fc4687e82d56783a929b87174f742c866 (diff)
downloadffmpeg-f05cd37d51dfcc7fc30d2cc1b1a0cc13bd527cb3.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>
-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;