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:
authorGregory Maxwell <greg@xiph.org>2012-07-14 23:49:20 +0400
committerGregory Maxwell <greg@xiph.org>2012-07-14 23:50:30 +0400
commitd060dd7cbd6405c8a31510ca17adb1e051934f49 (patch)
treec93da8e9789914cf4f373723266a471c40cd02e5
parentce878836864b1db3f2bf01575a36a2b230668bd8 (diff)
Opus_multistream API hardening.
-rw-r--r--src/opus_multistream.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/opus_multistream.c b/src/opus_multistream.c
index 1128c07e..5b2519df 100644
--- a/src/opus_multistream.c
+++ b/src/opus_multistream.c
@@ -163,6 +163,10 @@ int opus_multistream_encoder_init(
int i;
char *ptr;
+ if ((channels>255) || (coupled_streams>streams) ||
+ (coupled_streams+streams>255) || (streams<1) || (coupled_streams<0))
+ return OPUS_BAD_ARG;
+
st->layout.nb_channels = channels;
st->layout.nb_streams = streams;
st->layout.nb_coupled_streams = coupled_streams;
@@ -534,6 +538,10 @@ int opus_multistream_decoder_init(
int i, ret;
char *ptr;
+ if ((channels>255) || (coupled_streams>streams) ||
+ (coupled_streams+streams>255) || (streams<1) || (coupled_streams<0))
+ return OPUS_BAD_ARG;
+
st->layout.nb_channels = channels;
st->layout.nb_streams = streams;
st->layout.nb_coupled_streams = coupled_streams;