mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-02 04:52:09 +00:00
avcodec/utvideodec: Fix undefined behavior in shift
Fixes: asan_heap-oob_2573085_3783_utvideo_rgba_median.avi Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
35dcc8a040
commit
48efe9ec86
@ -56,13 +56,14 @@ static int build_huff(const uint8_t *src, VLC *vlc, int *fsym)
|
||||
*fsym = he[0].sym;
|
||||
return 0;
|
||||
}
|
||||
if (he[0].len > 32)
|
||||
return -1;
|
||||
|
||||
last = 255;
|
||||
while (he[last].len == 255 && last)
|
||||
last--;
|
||||
|
||||
if (he[last].len > 32)
|
||||
return -1;
|
||||
|
||||
code = 1;
|
||||
for (i = last; i >= 0; i--) {
|
||||
codes[i] = code >> (32 - he[i].len);
|
||||
|
Loading…
Reference in New Issue
Block a user