[vlc-commits] au: signed -> unsigned to avoid undefined overflow

Rémi Denis-Courmont git at videolan.org
Tue Feb 7 22:16:05 CET 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Feb  7 23:10:32 2017 +0200| [4d1b423efa63d21946f7720d73c0b58091561dbe] | committer: Rémi Denis-Courmont

au: signed -> unsigned to avoid undefined overflow

(The core will reject the insane audio format anyway.)

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

 modules/demux/au.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/demux/au.c b/modules/demux/au.c
index 27ca439..411333b 100644
--- a/modules/demux/au.c
+++ b/modules/demux/au.c
@@ -107,7 +107,6 @@ static int Open( vlc_object_t *p_this )
     uint8_t      hdr[20];
     const uint8_t *p_peek;
     int          i_cat;
-    int          i_samples, i_modulo;
 
     if( vlc_stream_Peek( p_demux->s , &p_peek, 4 ) < 4 )
         return VLC_EGENERIC;
@@ -272,14 +271,15 @@ static int Open( vlc_object_t *p_this )
     p_sys->es = es_out_Add( p_demux->out, &p_sys->fmt );
 
     /* calculate 50ms frame size/time */
-    i_samples = __MAX( p_sys->fmt.audio.i_rate / 20, 1 );
+    unsigned i_samples = __MAX( p_sys->fmt.audio.i_rate / 20, 1 );
     p_sys->i_frame_size = i_samples * p_sys->fmt.audio.i_channels *
                           ( (p_sys->fmt.audio.i_bitspersample + 7) / 8 );
     if( p_sys->fmt.audio.i_blockalign > 0 )
     {
-        if( ( i_modulo = p_sys->i_frame_size % p_sys->fmt.audio.i_blockalign ) != 0 )
+        unsigned mod = p_sys->i_frame_size % p_sys->fmt.audio.i_blockalign;
+        if( mod != 0 )
         {
-            p_sys->i_frame_size += p_sys->fmt.audio.i_blockalign - i_modulo;
+            p_sys->i_frame_size += p_sys->fmt.audio.i_blockalign - mod;
         }
     }
     p_sys->i_frame_length = (mtime_t)1000000 *



More information about the vlc-commits mailing list