Commit de052ea4 authored by Andrew D'Addesio's avatar Andrew D'Addesio Committed by Rostislav Pehlivanov

opus_celt: Fix arithmetic overflow (per RFC8251)

As per Sec.8 of RFC8251:
    Cap on Band Energy
    NaN due to large log-energy value. Affects celt_denormalize().
Signed-off-by: 's avatarAndrew D'Addesio <modchipv12@gmail.com>
parent 511e6f17
......@@ -481,7 +481,8 @@ static void celt_denormalize(CeltFrame *f, CeltBlock *block, float *data)
for (i = f->start_band; i < f->end_band; i++) {
float *dst = data + (ff_celt_freq_bands[i] << f->size);
float norm = exp2f(block->energy[i] + ff_celt_mean_energy[i]);
float log_norm = block->energy[i] + ff_celt_mean_energy[i];
float norm = exp2f(FFMIN(log_norm, 32.0f));
for (j = 0; j < ff_celt_freq_range[i] << f->size; j++)
dst[j] *= norm;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment