Commit 730eefea authored by Laurent Aimar's avatar Laurent Aimar

Protect against unsupported/invalid wav speaker mask.

parent d9f560ed
......@@ -123,7 +123,7 @@ static int Open( vlc_object_t * p_this )
return VLC_ENOMEM;
p_sys->p_es = NULL;
p_sys->b_chan_reorder = 0;
p_sys->b_chan_reorder = false;
p_sys->i_channel_mask = 0;
/* skip riff header */
......@@ -197,12 +197,22 @@ static int Open( vlc_object_t * p_this )
i_channel_mask = GetDWLE( &p_wf_ext->dwChannelMask );
if( i_channel_mask )
{
int i_match = 0;
for( i = 0; i < sizeof(pi_channels_src)/sizeof(uint32_t); i++ )
{
if( i_channel_mask & pi_channels_src[i] )
{
if( !( p_sys->i_channel_mask & pi_channels_in[i] ) )
i_match++;
p_sys->i_channel_mask |= pi_channels_in[i];
}
}
if( i_match != p_sys->fmt.audio.i_channels )
{
msg_Err( p_demux, "Invalid/unsupported channel mask" );
p_sys->i_channel_mask = 0;
}
}
}
else if( GetWLE( &p_wf->wFormatTag ) == WAVE_FORMAT_PCM &&
p_sys->fmt.audio.i_channels > 2 && p_sys->fmt.audio.i_channels <= 9 )
......
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