Commit da30d0ce authored by Michael Niedermayer's avatar Michael Niedermayer

libavcodec/mpegaudio_tablegen: clip value before casting

Avoids FPE on alpha
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent c68faca6
...@@ -63,7 +63,7 @@ static void mpegaudio_tableinit(void) ...@@ -63,7 +63,7 @@ static void mpegaudio_tableinit(void)
/* cbrtf() isn't available on all systems, so we use powf(). */ /* cbrtf() isn't available on all systems, so we use powf(). */
double f = (double)value * pow(value, 1.0 / 3.0) * pow(2, (exponent - 400) * 0.25 + FRAC_BITS + 5) / IMDCT_SCALAR; double f = (double)value * pow(value, 1.0 / 3.0) * pow(2, (exponent - 400) * 0.25 + FRAC_BITS + 5) / IMDCT_SCALAR;
/* llrint() isn't always available, so round and cast manually. */ /* llrint() isn't always available, so round and cast manually. */
expval_table_fixed[exponent][value] = (long long int) floor(f + 0.5); expval_table_fixed[exponent][value] = (long long int) FFMIN(floor(f + 0.5), 0xFFFFFFFF);
expval_table_float[exponent][value] = f; expval_table_float[exponent][value] = f;
} }
exp_table_fixed[exponent] = expval_table_fixed[exponent][1]; exp_table_fixed[exponent] = expval_table_fixed[exponent][1];
......
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