Found by reviewing code related to CID1604365 Overflowed constant
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -231,8 +231,8 @@ static int read_high_coeffs(AVCodecContext *avctx, const uint8_t *src, int16_t * · 230 unmodified lines | |||
| 231 | if (cnt1 >= length) { | 231 | if (cnt1 >= length) { |
| 232 | cnt1 = get_bits(bc, nbits); | 232 | cnt1 = get_bits(bc, nbits); |
| 233 | } else { | 233 | } else { |
| 234 | pfx = 14 + ((((uint64_t)(value - 14)) >> 32) & (value - 14)); | 234 | pfx = FFMIN(value, 14); |
| 235 | if (pfx < 1 || pfx > 25) | 235 | if (pfx < 1) |
| 236 | return AVERROR_INVALIDDATA; | 236 | return AVERROR_INVALIDDATA; |
| 237 | cnt1 *= (1 << pfx) - 1; | 237 | cnt1 *= (1 << pfx) - 1; |
| 238 | shbits = show_bits(bc, pfx); | 238 | shbits = show_bits(bc, pfx); |