mirror of https://git.ffmpeg.org/ffmpeg.git
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 341f01290c
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
dbb121688c
commit
6ae1b70cb4
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue