ref: c913640df809bce172dd21daff9a8d14bc0e39cb
parent: 95ed44167259b3d2ccd713a71102c84f20674d21
author: lieff <lieff@users.noreply.github.com>
date: Sun Feb 11 19:32:39 EST 2018
fix shift overflow in L3_ldexp_q2 with big iscf[]
--- a/minimp3.h
+++ b/minimp3.h
@@ -716,7 +716,10 @@
for (i = 0; i < (int)(gr->n_long_sfb + gr->n_short_sfb); i++)
{
- scf[i] = gain*L3_ldexp_q2(iscf[i] << scf_shift);
+ if (((iscf[i] << scf_shift) >> 2) >= 31)
+ scf[i] = gain*L3_ldexp_q2((iscf[i] << scf_shift) - 30*4) * /*L3_ldexp_q2(30*4)*/ 9.313226e-10f;
+ else
+ scf[i] = gain*L3_ldexp_q2(iscf[i] << scf_shift);
}
}