[vlc-commits] AIFF: avoid division by 0

Jean-Baptiste Kempf git at videolan.org
Sat Nov 10 22:30:57 CET 2012


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Nov 10 22:30:27 2012 +0100| [d82327460779ea62d6debc0e08b7f57c7bf384a4] | committer: Jean-Baptiste Kempf

AIFF: avoid division by 0

Close #7739

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

 modules/demux/aiff.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/demux/aiff.c b/modules/demux/aiff.c
index a236582..373bada 100644
--- a/modules/demux/aiff.c
+++ b/modules/demux/aiff.c
@@ -143,7 +143,8 @@ static int Open( vlc_object_t *p_this )
             p_sys->fmt.audio.i_rate     = GetF80BE( &p_peek[16] );
 
             msg_Dbg( p_demux, "COMM: channels=%d samples_frames=%d bits=%d rate=%d",
-                     GetWBE( &p_peek[8] ), GetDWBE( &p_peek[10] ), GetWBE( &p_peek[14] ), GetF80BE( &p_peek[16] ) );
+                     GetWBE( &p_peek[8] ), GetDWBE( &p_peek[10] ), GetWBE( &p_peek[14] ),
+                     GetF80BE( &p_peek[16] ) );
         }
         else if( !memcmp( p_peek, "SSND", 4 ) )
         {
@@ -181,7 +182,7 @@ static int Open( vlc_object_t *p_this )
     p_sys->i_ssnd_fsize = p_sys->fmt.audio.i_channels *
                           ((p_sys->fmt.audio.i_bitspersample + 7) / 8);
 
-    if( p_sys->i_ssnd_fsize <= 0 )
+    if( p_sys->i_ssnd_fsize <= 0 || p_sys->fmt.audio.i_rate == 0 )
     {
         msg_Err( p_demux, "invalid audio parameters" );
         goto error;



More information about the vlc-commits mailing list