Permalink
Browse files

Fixes packet parsing for 16-bit CPUs

Without that change, a very long (> 682 ms) illegal packet could trigger
a wrap-around in the test and be accepted as valid.

Only 16-bit architectures (e.g. TI C5x) were affected.
  • Loading branch information...
jmvalin committed Sep 14, 2018
1 parent c6d977a commit 4a643d98c388727e73aebbe626a7379c6fddbbbe
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/opus.c
View
@@ -252,7 +252,7 @@ int opus_packet_parse_impl(const unsigned char *data, opus_int32 len,
/* Number of frames encoded in bits 0 to 5 */
ch = *data++;
count = ch&0x3F;
if (count <= 0 || framesize*count > 5760)
if (count <= 0 || framesize*(opus_int32)count > 5760)
return OPUS_INVALID_PACKET;
len--;
/* Padding flag is bit 6 */

0 comments on commit 4a643d9

Please sign in to comment.