[vlc-commits] commit: Avoid integer overflow (Christophe Mutricy )

git at videolan.org git at videolan.org
Sat Mar 20 01:38:48 CET 2010


vlc | branch: master | Christophe Mutricy <xtophe at videolan.org> | Fri Mar 19 17:27:01 2010 +0000| [6eedf20f375a3cfe4ab475ec3a31fd7f83a5dd19] | committer: Christophe Mutricy 

Avoid integer overflow

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

 modules/demux/asf/libasf.c |    2 +-
 modules/demux/avi/libavi.c |    2 +-
 modules/demux/mp4/libmp4.c |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/demux/asf/libasf.c b/modules/demux/asf/libasf.c
index 65b05b0..803c849 100644
--- a/modules/demux/asf/libasf.c
+++ b/modules/demux/asf/libasf.c
@@ -1487,7 +1487,7 @@ static void ASF_ObjectDumpDebug( vlc_object_t *p_obj,
     psz_name = ASF_ObjectDumpDebugInfo[i].psz_name;
 
     char str[512];
-    if( i_level * 5 + 1 >= sizeof(str) )
+    if( i_level >= (sizeof(str) - 1)/5 )
         return;
 
     memset( str, ' ', sizeof( str ) );
diff --git a/modules/demux/avi/libavi.c b/modules/demux/avi/libavi.c
index 9f857d8..45d20e2 100644
--- a/modules/demux/avi/libavi.c
+++ b/modules/demux/avi/libavi.c
@@ -803,7 +803,7 @@ static void AVI_ChunkDumpDebug_level( vlc_object_t *p_obj,
     avi_chunk_t *p_child;
 
     char str[512];
-    if( i_level * 5 + 1 >= sizeof(str) )
+    if( i_level >= (sizeof(str) - 1)/5 )
         return;
 
     memset( str, ' ', sizeof( str ) );
diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 9a92934..c84b74e 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -2895,7 +2895,7 @@ static void __MP4_BoxDumpStructure( stream_t *s,
         unsigned int i;
 
         char str[512];
-        if( i_level * 5 + 1 >= sizeof(str) )
+        if( i_level >= (sizeof(str) - 1)/5 )
             return;
 
         memset( str, ' ', sizeof(str) );



More information about the vlc-commits mailing list