shithub: opus-tools

Download patch

ref: 11fe5419b018ef54ee505fc5cb6ccbcbf86464c8
parent: 839da0edc19e9d538501919f74ff36b96acb63a8
author: Sherief N. Farouk <sherief.farouk@twisted-works.com>
date: Tue Nov 3 12:30:23 EST 2009

Fixed potential over-allocation / (fatal) under-allocation on platforms where sizeof(int) != 4.

--- a/src/resample.c
+++ b/src/resample.c
@@ -768,9 +768,9 @@
 #endif
    
    /* Per channel data */
-   st->last_sample = (spx_int32_t*)speex_alloc(nb_channels*sizeof(int));
-   st->magic_samples = (spx_uint32_t*)speex_alloc(nb_channels*sizeof(int));
-   st->samp_frac_num = (spx_uint32_t*)speex_alloc(nb_channels*sizeof(int));
+   st->last_sample = (spx_int32_t*)speex_alloc(nb_channels*sizeof(spx_int32_t));
+   st->magic_samples = (spx_uint32_t*)speex_alloc(nb_channels*sizeof(spx_uint32_t));
+   st->samp_frac_num = (spx_uint32_t*)speex_alloc(nb_channels*sizeof(spx_uint32_t));
    for (i=0;i<nb_channels;i++)
    {
       st->last_sample[i] = 0;