[vlc-commits] a52: fix undefined left shift of negative value

Rémi Denis-Courmont git at videolan.org
Sun Jun 8 10:48:15 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jun  8 11:47:15 2014 +0300| [68f1623b0bba378deb64b2a22eb852732f5ec73e] | committer: Rémi Denis-Courmont

a52: fix undefined left shift of negative value

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=68f1623b0bba378deb64b2a22eb852732f5ec73e
---

 modules/audio_filter/converter/a52tofloat32.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/audio_filter/converter/a52tofloat32.c b/modules/audio_filter/converter/a52tofloat32.c
index 346a36d..0a892ce 100644
--- a/modules/audio_filter/converter/a52tofloat32.c
+++ b/modules/audio_filter/converter/a52tofloat32.c
@@ -236,7 +236,7 @@ static void Interleave( sample_t *restrict p_out, const sample_t *restrict p_in,
         for( unsigned i = 0; i < 256; i++ )
         {
 #ifdef LIBA52_FIXED
-            p_out[i * i_nb_channels + pi_chan_table[j]] = p_in[j * 256 + i] << 4;
+            p_out[i * i_nb_channels + pi_chan_table[j]] = ((uint32_t)p_in[j * 256 + i]) << 4;
 #else
             p_out[i * i_nb_channels + pi_chan_table[j]] = p_in[j * 256 + i];
 #endif
@@ -252,7 +252,7 @@ static void Duplicate( sample_t *restrict p_out, const sample_t *restrict p_in )
     for( unsigned i = 256; i--; )
     {
 #ifdef LIBA52_FIXED
-        sample_t s = *(p_in++) << 4;
+        sample_t s = ((uint32_t)*(p_in++)) << 4;
 #else
         sample_t s = *(p_in++);
 #endif
@@ -272,8 +272,8 @@ static void Exchange( sample_t *restrict p_out, const sample_t *restrict p_in )
     for( unsigned i = 0; i < 256; i++ )
     {
 #ifdef LIBA52_FIXED
-        *p_out++ = *p_first++ << 4;
-        *p_out++ = *p_second++ << 4;
+        *p_out++ = ((uint32_t)*p_first++) << 4;
+        *p_out++ = ((uint32_t)*p_second++) << 4;
 #else
         *p_out++ = *p_first++;
         *p_out++ = *p_second++;



More information about the vlc-commits mailing list