Found by code review related to CID1604563 Overflowed return value
Unified · Split
| @@ -402,6 +402,7 @@ static inline int get_ur_golomb(GetBitContext *gb, int k, int limit, · 401 unmodified lines | |||
| 402 | log = av_log2(buf); | 402 | log = av_log2(buf); |
| 403 | 403 | ||
| 404 | if (log > 31 - limit) { | 404 | if (log > 31 - limit) { |
| 405 | av_assert2(log >= k); | ||
| 405 | buf >>= log - k; | 406 | buf >>= log - k; |
| 406 | buf += (30U - log) << k; | 407 | buf += (30U - log) << k; |
| 407 | LAST_SKIP_BITS(re, gb, 32 + k - log); | 408 | LAST_SKIP_BITS(re, gb, 32 + k - log); |