From a8f04b23f97e42975c033e2f4d11e25498e9e6b8 Mon Sep 17 00:00:00 2001
From: "Timothy B. Terriberry" <tterribe@xiph.org>
Date: Mon, 18 Mar 2013 14:42:44 -0700
Subject: [PATCH] Fix some 16-bit int issues in the multistream API.

With 120 ms frames and 6 or more channels, the total number of
 samples in the buffer could overflow.
---
 src/opus_multistream_decoder.c | 4 ++--
 src/opus_multistream_encoder.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/opus_multistream_decoder.c b/src/opus_multistream_decoder.c
index 47f87b193..495fb07e3 100644
--- a/src/opus_multistream_decoder.c
+++ b/src/opus_multistream_decoder.c
@@ -274,7 +274,7 @@ static void opus_copy_channel_out_float(
 )
 {
    float *float_dst;
-   int i;
+   opus_int32 i;
    float_dst = (float*)dst;
    if (src != NULL)
    {
@@ -303,7 +303,7 @@ static void opus_copy_channel_out_short(
 )
 {
    opus_int16 *short_dst;
-   int i;
+   opus_int32 i;
    short_dst = (opus_int16*)dst;
    if (src != NULL)
    {
diff --git a/src/opus_multistream_encoder.c b/src/opus_multistream_encoder.c
index 66c75ca11..1847bd5ae 100644
--- a/src/opus_multistream_encoder.c
+++ b/src/opus_multistream_encoder.c
@@ -356,7 +356,7 @@ static void opus_copy_channel_in_float(
 )
 {
    const float *float_src;
-   int i;
+   opus_int32 i;
    float_src = (const float *)src;
    for (i=0;i<frame_size;i++)
 #if defined(FIXED_POINT)
@@ -377,7 +377,7 @@ static void opus_copy_channel_in_short(
 )
 {
    const opus_int16 *short_src;
-   int i;
+   opus_int32 i;
    short_src = (const opus_int16 *)src;
    for (i=0;i<frame_size;i++)
 #if defined(FIXED_POINT)
-- 
GitLab