goto error;
t += t2;
} else {
- if (get_bits_left(gb) < t2 - 1)
+ if (t2 >= 32 || get_bits_left(gb) < t2 - 1)
goto error;
t += get_bits_long(gb, t2 - 1) | (1 << (t2 - 1));
}
INC_MED(1);
DEC_MED(2);
} else {
- base = GET_MED(0) + GET_MED(1) + GET_MED(2) * (t - 2);
+ base = GET_MED(0) + GET_MED(1) + GET_MED(2) * (t - 2U);
add = GET_MED(2) - 1;
INC_MED(0);
INC_MED(1);
add -= (mid - (unsigned)base);
base = mid;
} else
- add = mid - base - 1;
+ add = mid - (unsigned)base - 1;
mid = (base * 2U + add + 1) >> 1;
}
ret = mid;
S *= 1U << s->float_shift;
sign = S < 0;
if (sign)
- S = -S;
- if (S >= 0x1000000) {
+ S = -(unsigned)S;
+ if (S >= 0x1000000U) {
if (s->got_extra_bits && get_bits1(&s->gb_extra_bits))
S = get_bits(&s->gb_extra_bits, 23);
else
}
if (type == AV_SAMPLE_FMT_S16P) {
- if (FFABS(L) + FFABS(R) > (1<<19)) {
+ if (FFABS(L) + (unsigned)FFABS(R) > (1<<19)) {
av_log(s->avctx, AV_LOG_ERROR, "sample %d %d too large\n", L, R);
return AVERROR_INVALIDDATA;
}
continue;
}
bytestream2_get_buffer(&gb, val, 4);
- if (val[0] > 31) {
+ if (val[0] > 30) {
av_log(avctx, AV_LOG_ERROR,
- "Invalid INT32INFO, extra_bits = %d (> 32)\n", val[0]);
+ "Invalid INT32INFO, extra_bits = %d (> 30)\n", val[0]);
continue;
} else if (val[0]) {
s->extra_bits = val[0];