[FFmpeg-cvslog] avcodec/mpegaudiodec_template: make shift unsigned to avoid undefined behavior

Michael Niedermayer git at videolan.org
Fri May 9 13:44:16 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri May  9 12:45:17 2014 +0200| [0be95996d0a07a2f92105da1ed8c13d239c46ad8] | committer: Michael Niedermayer

avcodec/mpegaudiodec_template: make shift unsigned to avoid undefined behavior

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

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

 libavcodec/mpegaudiodec_template.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c
index 1c1ab6e..6ae34ae 100644
--- a/libavcodec/mpegaudiodec_template.c
+++ b/libavcodec/mpegaudiodec_template.c
@@ -216,7 +216,7 @@ static inline int l1_unscale(int n, int mant, int scale_factor)
     shift   = scale_factor_modshift[scale_factor];
     mod     = shift & 3;
     shift >>= 2;
-    val     = MUL64(mant + (-1 << n) + 1, scale_factor_mult[n-1][mod]);
+    val     = MUL64((int)(mant + (-1U << n) + 1), scale_factor_mult[n-1][mod]);
     shift  += n;
     /* NOTE: at this point, 1 <= shift >= 21 + 15 */
     return (int)((val + (1LL << (shift - 1))) >> shift);



More information about the ffmpeg-cvslog mailing list