[vlc-commits] avi: avoid undefined signed overflow

Rémi Denis-Courmont git at videolan.org
Wed Mar 20 05:36:23 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Mar 20 06:27:33 2019 +0200| [2c3e03b4dc17f861f5148ea4f308e8c4a2e4d787] | committer: Rémi Denis-Courmont

avi: avoid undefined signed overflow

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

 modules/demux/avi/avi.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 4d6869f52f..2dfc7b4c6c 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -1045,7 +1045,7 @@ static int Demux_Seekable( demux_t *p_demux )
 
         if( i_pos == -1 )
         {
-            int i_loop_count = 0;
+            unsigned short i_loop_count = 0;
 
             /* no valid index, we will parse directly the stream
              * in case we fail we will disable all finished stream */
@@ -1092,7 +1092,7 @@ static int Demux_Seekable( demux_t *p_demux )
                     {
                         vlc_tick_sleep( VLC_HARD_MIN_SLEEP );
 
-                        if( !(i_loop_count % (1024 * 10)) )
+                        if( !i_loop_count )
                             msg_Warn( p_demux,
                                       "don't seem to find any data..." );
                     }
@@ -1786,7 +1786,7 @@ static int AVI_StreamChunkFind( demux_t *p_demux, unsigned int i_stream )
 {
     demux_sys_t *p_sys = p_demux->p_sys;
     avi_packet_t avi_pk;
-    int i_loop_count = 0;
+    unsigned short i_loop_count = 0;
 
     /* find first chunk of i_stream that isn't in index */
 
@@ -1827,7 +1827,7 @@ static int AVI_StreamChunkFind( demux_t *p_demux, unsigned int i_stream )
             {
                 vlc_tick_sleep( VLC_HARD_MIN_SLEEP );
 
-                if( !(i_loop_count % (1024 * 10)) )
+                if( !i_loop_count )
                     msg_Warn( p_demux, "don't seem to find any data..." );
             }
         }
@@ -2215,7 +2215,7 @@ static int AVI_PacketSearch( demux_t *p_demux )
 {
     demux_sys_t     *p_sys = p_demux->p_sys;
     avi_packet_t    avi_pk;
-    int             i_count = 0;
+    unsigned short  i_count = 0;
 
     for( ;; )
     {
@@ -2245,7 +2245,7 @@ static int AVI_PacketSearch( demux_t *p_demux )
         if( !(++i_count % 1024) )
         {
             vlc_tick_sleep( VLC_HARD_MIN_SLEEP );
-            if( !(i_count % (1024 * 10)) )
+            if( !i_count )
                 msg_Warn( p_demux, "trying to resync..." );
         }
     }



More information about the vlc-commits mailing list