bytestream2_skip(&gb, ssize);
continue;
}
- rate_x = 1 << bytestream2_get_byte(&gb);
+ rate_x = bytestream2_get_byte(&gb);
+ if (rate_x > 30)
+ return AVERROR_INVALIDDATA;
+ rate_x = 1 << rate_x;
dsd_mode = bytestream2_get_byte(&gb);
if (dsd_mode && dsd_mode != 1 && dsd_mode != 3) {
av_log(avctx, AV_LOG_ERROR, "Invalid DSD encoding mode: %d\n",
av_log(avctx, AV_LOG_ERROR, "Custom sample rate missing.\n");
return AVERROR_INVALIDDATA;
}
- new_samplerate = sample_rate * rate_x;
+ new_samplerate = sample_rate;
} else
- new_samplerate = wv_rates[sr] * rate_x;
+ new_samplerate = wv_rates[sr];
+
+ if (new_samplerate * (uint64_t)rate_x > INT_MAX)
+ return AVERROR_INVALIDDATA;
+ new_samplerate *= rate_x;
if (multiblock) {
if (chan)