1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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>
This commit is contained in:
Michael Niedermayer 2017-05-07 14:53:31 +02:00
parent 78bf446852
commit 2162b862eb

View File

@ -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);