[vlc-commits] speexdsp: fix integer overflow (probably fixes #5781)

Rémi Denis-Courmont git at videolan.org
Thu Feb 12 20:01:31 CET 2015


vlc/vlc-2.2 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Feb 12 20:54:58 2015 +0200| [26bda308d9d721613c49489ee356c4e1c37b00ec] | committer: Rémi Denis-Courmont

speexdsp: fix integer overflow (probably fixes #5781)

(cherry picked from commit 9feeba7bef8e54bd6782c4acd1e1941015cf46ee)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=26bda308d9d721613c49489ee356c4e1c37b00ec
---

 modules/audio_filter/resampler/speex.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/audio_filter/resampler/speex.c b/modules/audio_filter/resampler/speex.c
index 774fc8f..9b967bf 100644
--- a/modules/audio_filter/resampler/speex.c
+++ b/modules/audio_filter/resampler/speex.c
@@ -22,6 +22,8 @@
 # include <config.h>
 #endif
 
+#include <inttypes.h>
+
 #include <vlc_common.h>
 #include <vlc_aout.h>
 #include <vlc_filter.h>
@@ -124,7 +126,8 @@ static block_t *Resample (filter_t *filter, block_t *in)
     const unsigned orate = filter->fmt_out.audio.i_rate;
 
     spx_uint32_t ilen = in->i_nb_samples;
-    spx_uint32_t olen = ((ilen + 2) * orate * 11) / (irate * 10);
+    spx_uint32_t olen = ((ilen + 2) * orate * UINT64_C(11))
+                      / (irate * UINT64_C(10));
 
     block_t *out = block_Alloc (olen * framesize);
     if (unlikely(out == NULL))



More information about the vlc-commits mailing list