From 0884b1c5ffe07584984dadad29346c95c78fac19 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 6 May 2017 18:25:02 +0200 Subject: [PATCH] avcodec/golomb: Assert that k is valid in get_ur_golomb_jpegls() Signed-off-by: Michael Niedermayer --- libavcodec/golomb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h index 47b369f88c..6911759c6b 100644 --- a/libavcodec/golomb.h +++ b/libavcodec/golomb.h @@ -314,6 +314,8 @@ static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, log = av_log2(buf); + av_assert2(k <= 31); + if (log - k >= 32 - MIN_CACHE_BITS + (MIN_CACHE_BITS == 32) && 32 - log < limit) { buf >>= log - k;