[vlc-commits] vorbis (tremor): avoid overflow in conversion to signed integer
Rémi Denis-Courmont
git at videolan.org
Tue Jun 10 21:46:26 CEST 2014
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jun 10 22:46:09 2014 +0300| [06b6f01a13956758f030e458c5375eebfb701ad6] | committer: Rémi Denis-Courmont
vorbis (tremor): avoid overflow in conversion to signed integer
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=06b6f01a13956758f030e458c5375eebfb701ad6
---
modules/codec/vorbis.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/modules/codec/vorbis.c b/modules/codec/vorbis.c
index 7c136da..53b2c60 100644
--- a/modules/codec/vorbis.c
+++ b/modules/codec/vorbis.c
@@ -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 i = 0; i < i_nb_channels; i++ )
+ {
#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
p_out[j * i_nb_channels + pi_chan_table[i]] = pp_in[i][j];
#endif
+ }
}
/*****************************************************************************
More information about the vlc-commits
mailing list