[vlc-devel] commit: Check against too low sample rate and 0 channel count ( avoid division by 0) (Laurent Aimar )

git version control git at videolan.org
Sun Jun 29 18:21:25 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Jun 29 16:23:12 2008 +0000| [4e72534d7da8bb2cda63791ffe4d611e7dcf0929]

Check against too low sample rate and 0 channel count (avoid division by 0)

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

 src/audio_output/dec.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index 7814be5..a9eb16a 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -59,6 +59,11 @@ static aout_input_t * DecNew( vlc_object_t * p_this, aout_instance_t * p_aout,
                  p_format->i_channels );
         return NULL;
     }
+    if( p_format->i_channels <= 0 )
+    {
+        msg_Err( p_aout, "no audio channels" );
+        return NULL;
+    }
 
     if( p_format->i_rate > 192000 )
     {
@@ -66,6 +71,12 @@ static aout_input_t * DecNew( vlc_object_t * p_this, aout_instance_t * p_aout,
                  p_format->i_rate );
         return NULL;
     }
+    if( p_format->i_rate < 4000 )
+    {
+        msg_Err( p_aout, "too low audio sample frequency (%u)",
+                 p_format->i_rate );
+        return NULL;
+    }
 
     /* We can only be called by the decoder, so no need to lock
      * p_input->lock. */




More information about the vlc-devel mailing list