Commit 23340e22 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Fixes an int overflow in the VBR code

Also properly applies the MDCT filtering for resampling
parent 75228782
...@@ -950,7 +950,8 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i ...@@ -950,7 +950,8 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i
if (st->vbr) if (st->vbr)
{ {
vbr_rate = ((2*st->bitrate*frame_size<<BITRES)+st->mode->Fs)/(2*st->mode->Fs); celt_int32 den=st->mode->Fs>>BITRES;
vbr_rate=(st->bitrate*frame_size+(den>>1))/den;
effectiveBytes = vbr_rate>>3; effectiveBytes = vbr_rate>>3;
} else { } else {
celt_int32 tmp; celt_int32 tmp;
...@@ -2399,7 +2400,7 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da ...@@ -2399,7 +2400,7 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da
int bound = M*st->mode->eBands[effEnd]; int bound = M*st->mode->eBands[effEnd];
if (st->downsample!=1) if (st->downsample!=1)
bound = IMIN(bound, N/st->downsample); bound = IMIN(bound, N/st->downsample);
for (i=M*st->mode->eBands[effEnd];i<N;i++) for (i=bound;i<N;i++)
freq[c*N+i] = 0; freq[c*N+i] = 0;
} while (++c<C); } while (++c<C);
......
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