Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2012-12-03 22:05:24 +0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2012-12-03 22:05:24 +0400
commit259e166648832ba5bf4ed4d08aca87e8f5e8fe5c (patch)
treeee3aa82ff59a4986a91431137f1ad2fbe53135b9 /src/opus_decoder.c
parent54f7cb46291a4f5989a1515a4f092d40759bfd2b (diff)
Fix packet length handling for 16-bit machines (makes no difference on 32-bit)
Diffstat (limited to 'src/opus_decoder.c')
-rw-r--r--src/opus_decoder.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/opus_decoder.c b/src/opus_decoder.c
index 0be6730d..f0af5e74 100644
--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -589,7 +589,7 @@ static int opus_packet_parse_impl(const unsigned char *data, opus_int32 len,
int cbr;
unsigned char ch, toc;
int framesize;
- int last_size;
+ opus_int32 last_size;
const unsigned char *data0 = data;
if (size==NULL)
@@ -615,7 +615,9 @@ static int opus_packet_parse_impl(const unsigned char *data, opus_int32 len,
{
if (len&0x1)
return OPUS_INVALID_PACKET;
- size[0] = last_size = len/2;
+ last_size = len/2;
+ /* If last_size doesn't fit in size[0], we'll catch it later */
+ size[0] = (short)last_size;
}
break;
/* Two VBR frames */
@@ -676,7 +678,7 @@ static int opus_packet_parse_impl(const unsigned char *data, opus_int32 len,
if (last_size*count!=len)
return OPUS_INVALID_PACKET;
for (i=0;i<count-1;i++)
- size[i] = last_size;
+ size[i] = (short)last_size;
}
break;
}
@@ -704,7 +706,7 @@ static int opus_packet_parse_impl(const unsigned char *data, opus_int32 len,
1275. Reject them here.*/
if (last_size > 1275)
return OPUS_INVALID_PACKET;
- size[count-1] = last_size;
+ size[count-1] = (short)last_size;
}
if (frames)