ref: 914476c6531f63a69f66a1e8af20050a21bcdf21
parent: b66080a8794f7e49d519a8e3e063ae5c645f465e
author: Jean-Marc Valin <[email protected]>
date: Mon Jun 27 19:44:18 EDT 2016
Fixes an invalid read in compute_stereo_width() for 2.5 ms frames at 12 kHz That's the only size that's not a multiple of 4, so we just discard 2 samples from the calculation.
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -873,7 +873,10 @@
frame_rate = Fs/frame_size;
short_alpha = Q15ONE - MULT16_16(25, Q15ONE)/IMAX(50,frame_rate);
xx=xy=yy=0;
- for (i=0;i<frame_size;i+=4)
+ /* Unroll by 4. The frame size is always a multiple of 4 *except* for
+ 2.5 ms frames at 12 kHz. Since this setting is very rare (and very
+ stupid), we just discard the last two samples. */
+ for (i=0;i<frame_size-3;i+=4)
{
opus_val32 pxx=0;
opus_val32 pxy=0;