]> git.sesse.net Git - vlc/commitdiff
Check against too low sample rate and 0 channel count (avoid division by 0)
authorLaurent Aimar <fenrir@videolan.org>
Sun, 29 Jun 2008 16:23:12 +0000 (16:23 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 29 Jun 2008 16:23:12 +0000 (16:23 +0000)
src/audio_output/dec.c

index 7814be5dd8df12622813b40b3d90cf2dcfbc729b..a9eb16ac117172f9050c36a25dd69513afe74856 100644 (file)
@@ -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. */