[FFmpeg-cvslog] libavcodec/mpegaudio_tablegen: clip value before casting

Michael Niedermayer git at videolan.org
Tue Oct 22 13:48:44 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Oct 22 12:48:47 2013 +0200| [da30d0cec3ebeee65eb939f5da218ac258b0e05e] | committer: Michael Niedermayer

libavcodec/mpegaudio_tablegen: clip value before casting

Avoids FPE on alpha

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=da30d0cec3ebeee65eb939f5da218ac258b0e05e
---

 libavcodec/mpegaudio_tablegen.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mpegaudio_tablegen.h b/libavcodec/mpegaudio_tablegen.h
index 789bc2a..5592b4a 100644
--- a/libavcodec/mpegaudio_tablegen.h
+++ b/libavcodec/mpegaudio_tablegen.h
@@ -63,7 +63,7 @@ static void mpegaudio_tableinit(void)
             /* 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;
             /* 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;
         }
         exp_table_fixed[exponent] = expval_table_fixed[exponent][1];



More information about the ffmpeg-cvslog mailing list