Commit e426b400 authored by Thomas Guillem's avatar Thomas Guillem

transcode: audio: fix global-buffer-overflow

parent 263e1767
......@@ -109,6 +109,8 @@ static int transcode_audio_initialize_encoder( sout_stream_id_sys_t *id, sout_st
id->p_encoder->fmt_out.audio.i_channels = p_sys->i_channels > 0 ?
p_sys->i_channels : id->audio_dec_out.i_channels;
assert(id->p_encoder->fmt_out.audio.i_channels > 0);
if( id->p_encoder->fmt_out.audio.i_channels >= ARRAY_SIZE(pi_channels_maps) )
id->p_encoder->fmt_out.audio.i_channels = ARRAY_SIZE(pi_channels_maps) - 1;
id->p_encoder->fmt_in.audio.i_physical_channels =
id->p_encoder->fmt_out.audio.i_physical_channels =
......@@ -421,6 +423,9 @@ bool transcode_audio_add( sout_stream_t *p_stream, const es_format_t *p_fmt,
id->p_encoder->fmt_out.audio.i_channels = p_sys->i_channels > 0 ?
p_sys->i_channels : p_fmt->audio.i_channels;
if( id->p_encoder->fmt_out.audio.i_channels >= ARRAY_SIZE(pi_channels_maps) )
id->p_encoder->fmt_out.audio.i_channels = ARRAY_SIZE(pi_channels_maps) - 1;
id->p_encoder->fmt_in.audio.i_physical_channels =
id->p_encoder->fmt_out.audio.i_physical_channels =
pi_channels_maps[id->p_encoder->fmt_out.audio.i_channels];
......
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