mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/golomb: Assert that k is in the supported range for get_ur/sr_golomb()
Found by code review related to CID1604563 Overflowed return value Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
7cf5b83f6f
commit
b2aaeb81f6
|
@ -402,6 +402,7 @@ static inline int get_ur_golomb(GetBitContext *gb, int k, int limit,
|
||||||
log = av_log2(buf);
|
log = av_log2(buf);
|
||||||
|
|
||||||
if (log > 31 - limit) {
|
if (log > 31 - limit) {
|
||||||
|
av_assert2(log >= k);
|
||||||
buf >>= log - k;
|
buf >>= log - k;
|
||||||
buf += (30U - log) << k;
|
buf += (30U - log) << k;
|
||||||
LAST_SKIP_BITS(re, gb, 32 + k - log);
|
LAST_SKIP_BITS(re, gb, 32 + k - log);
|
||||||
|
|
Loading…
Reference in New Issue