Commit 9cd0bbb7 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

mad: robustify against corrupt byte streams (fixes #10726)

parent b1123693
......@@ -103,6 +103,7 @@ static void DoWork( filter_t * p_filter,
if( p_sys->i_reject_count > 0 )
{
reject:
memset( p_out_buf->p_buffer, 0, p_out_buf->i_buffer );
p_sys->i_reject_count--;
return;
......@@ -117,7 +118,14 @@ static void DoWork( filter_t * p_filter,
mad_fixed_t const * p_right = p_pcm->samples[1];
float *p_samples = (float *)p_out_buf->p_buffer;
assert( i_samples == p_out_buf->i_nb_samples );
if( i_samples != p_out_buf->i_nb_samples )
{
msg_Err( p_filter, "unexpected samples count (corrupt stream?): "
"%u / %u", i_samples, p_out_buf->i_nb_samples );
p_sys->i_reject_count = 3;
goto reject;
}
/* Interleave and keep buffers in mad_fixed_t format */
if ( p_pcm->channels == 2 )
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment