summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <[email protected]>2017-07-12 17:25:16 +0200
committerMichael Niedermayer <[email protected]>2017-07-19 15:26:37 +0200
commit6ae1b70cb42bccf4255a5f41cee3369295ed294c (patch)
treeeaecd577f743b9db287c21c42b657fe71a87241c
parentdbb121688cecabf2210f598b17a1567506d5c634 (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 <[email protected]> (cherry picked from commit 341f01290c2353669ed2263f56e1a9f4c67cc597) Signed-off-by: Michael Niedermayer <[email protected]>
-rw-r--r--libavcodec/magicyuv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c
index 5f09c0be53..acb94f57ee 100644
--- a/libavcodec/magicyuv.c
+++ b/libavcodec/magicyuv.c
@@ -97,7 +97,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);
@@ -129,7 +129,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);