diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-07-12 18:25:16 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-07-12 18:26:18 +0300 |
commit | 341f01290c2353669ed2263f56e1a9f4c67cc597 (patch) | |
tree | f7a6864c6b071828a042921de22f4a2c0a7fec7e /libavcodec/magicyuv.c | |
parent | c28f648b19dd36ff9bc869ad527a1569a0b623e2 (diff) |
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>
Diffstat (limited to 'libavcodec/magicyuv.c')
-rw-r--r-- | libavcodec/magicyuv.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c index 447fe33aff..3c1a89077b 100644 --- a/libavcodec/magicyuv.c +++ b/libavcodec/magicyuv.c @@ -104,7 +104,7 @@ static int huff_build10(VLC *vlc, uint8_t *len) for (i = 0; i < 1024; i++) { he[i].sym = 1023 - i; he[i].len = len[i]; - if (len[i] == 0) + if (len[i] == 0 || len[i] > 32) return AVERROR_INVALIDDATA; } AV_QSORT(he, 1024, HuffEntry, huff_cmp_len10); @@ -136,7 +136,7 @@ static int huff_build12(VLC *vlc, uint8_t *len) for (i = 0; i < 4096; i++) { he[i].sym = 4095 - i; he[i].len = len[i]; - if (len[i] == 0) + if (len[i] == 0 || len[i] > 32) return AVERROR_INVALIDDATA; } AV_QSORT(he, 4096, HuffEntry, huff_cmp_len12); @@ -168,7 +168,7 @@ static int huff_build(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) + if (len[i] == 0 || len[i] > 32) return AVERROR_INVALIDDATA; } AV_QSORT(he, 256, HuffEntry, huff_cmp_len); |