From: Laurent Aimar Date: Sun, 29 Jun 2008 16:23:12 +0000 (+0000) Subject: Check against too low sample rate and 0 channel count (avoid division by 0) X-Git-Tag: 0.9.0-test1~43 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=4e72534d7da8bb2cda63791ffe4d611e7dcf0929;p=vlc Check against too low sample rate and 0 channel count (avoid division by 0) --- diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c index 7814be5dd8..a9eb16ac11 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. */