diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-07-12 17:25:16 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-07-19 03:53:54 +0200 |
commit | 94077cf6735afd1a166848d388c3a59764e7c71c (patch) | |
tree | 991995e5fafa8f9804873abdfb7a88f986c88368 | |
parent | 506bbbc09929e1d2778259fb9549743c5bce5fdc (diff) | |
download | ffmpeg-94077cf6735afd1a166848d388c3a59764e7c71c.tar.gz |
avcodec/magicyuv: Check that vlc len is not too large
Fixes: runtime error: shift exponent -95 is negative
Fixes: 2568/clusterfuzz-testcase-minimized-4926115716005888
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 341f01290c2353669ed2263f56e1a9f4c67cc597)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/magicyuv.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c index 3bb4c5a8b4..fdd427920c 100644 --- a/libavcodec/magicyuv.c +++ b/libavcodec/magicyuv.c @@ -90,6 +90,8 @@ static int build_huff(VLC *vlc, uint8_t *len) for (i = 0; i < 256; i++) { he[i].sym = 255 - i; he[i].len = len[i]; + if (len[i] == 0 || len[i] > 32) + return AVERROR_INVALIDDATA; } AV_QSORT(he, 256, HuffEntry, ff_magy_huff_cmp_len); |