diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-05-17 19:07:17 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-06-01 23:25:21 +0200 |
commit | 666295ebabc46127b70deb16bba4496a873e83bb (patch) | |
tree | 3447eef16ffa34b64ab649876c5e4ec18c83d453 /libavcodec | |
parent | 9ce3e804ffae7267716d130dd3e5b3be4a12534f (diff) | |
download | ffmpeg-666295ebabc46127b70deb16bba4496a873e83bb.tar.gz |
avcodec/golomb: get_ur_golomb_jpegls: Fix reading huge k values
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c720b9ce9850710e74a103d9626869e397a89faa)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/golomb.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h index 81d8aeef9e..a65c17e326 100644 --- a/libavcodec/golomb.h +++ b/libavcodec/golomb.h @@ -346,8 +346,16 @@ static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, if (i < limit - 1) { if (k) { - buf = SHOW_UBITS(re, gb, k); - LAST_SKIP_BITS(re, gb, k); + if (k > MIN_CACHE_BITS - 1) { + buf = SHOW_UBITS(re, gb, 16) << (k-16); + LAST_SKIP_BITS(re, gb, 16); + UPDATE_CACHE(re, gb); + buf |= SHOW_UBITS(re, gb, k-16); + LAST_SKIP_BITS(re, gb, k-16); + } else { + buf = SHOW_UBITS(re, gb, k); + LAST_SKIP_BITS(re, gb, k); + } } else { buf = 0; } |