Commit 06b6f01a authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vorbis (tremor): avoid overflow in conversion to signed integer

parent 0ba6f6e9
...@@ -470,11 +470,16 @@ static void Interleave( INTERLEAVE_TYPE *p_out, const INTERLEAVE_TYPE **pp_in, ...@@ -470,11 +470,16 @@ static void Interleave( INTERLEAVE_TYPE *p_out, const INTERLEAVE_TYPE **pp_in,
{ {
for( int j = 0; j < i_samples; j++ ) for( int j = 0; j < i_samples; j++ )
for( int i = 0; i < i_nb_channels; i++ ) for( int i = 0; i < i_nb_channels; i++ )
{
#ifdef MODULE_NAME_IS_tremor #ifdef MODULE_NAME_IS_tremor
p_out[j * i_nb_channels + pi_chan_table[i]] = ((uint32_t)pp_in[i][j]) << 8; union { int32_t i; uint32_t u;} spl;
spl.u = ((uint32_t)pp_in[i][j]) << 8;
p_out[j * i_nb_channels + pi_chan_table[i]] = spl.i;
#else #else
p_out[j * i_nb_channels + pi_chan_table[i]] = pp_in[i][j]; p_out[j * i_nb_channels + pi_chan_table[i]] = pp_in[i][j];
#endif #endif
}
} }
/***************************************************************************** /*****************************************************************************
......
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