aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-07 14:53:31 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-07 15:31:00 +0200
commit2162b862eba5aadb59c0cf7cc304c67f4a5fb946 (patch)
treebab3e41e0f282bb15bb62d28c859db01928757d3
parent78bf446852a7e5e8aa52c7ca9889632e167b665f (diff)
downloadffmpeg-2162b862eba5aadb59c0cf7cc304c67f4a5fb946.tar.gz
avcodec/magicyuv: Check len to be supported
Fixes: shift exponent -1 is negative Fixes: 1390/clusterfuzz-testcase-minimized-5452757630713856 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/magicyuv.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c
index 6250536da6..5f09c0be53 100644
--- a/libavcodec/magicyuv.c
+++ b/libavcodec/magicyuv.c
@@ -97,6 +97,8 @@ 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)
+ return AVERROR_INVALIDDATA;
}
AV_QSORT(he, 1024, HuffEntry, huff_cmp_len10);
@@ -127,6 +129,8 @@ 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)
+ return AVERROR_INVALIDDATA;
}
AV_QSORT(he, 256, HuffEntry, huff_cmp_len);