diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-11-11 03:34:58 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-11-11 03:35:57 +0100 |
commit | 48efe9ec86acf6dcf6aabef2114f8dd04e4fbce4 (patch) | |
tree | 3b52d890d733746b83e23adf406c70af7fd011ee | |
parent | 35dcc8a0405788de392ed116dd628aef2772003d (diff) | |
download | ffmpeg-48efe9ec86acf6dcf6aabef2114f8dd04e4fbce4.tar.gz |
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>
-rw-r--r-- | libavcodec/utvideodec.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c index 05c943f808..b565c1076c 100644 --- a/libavcodec/utvideodec.c +++ b/libavcodec/utvideodec.c @@ -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); |