diff options
author | Gregory Maxwell <greg@xiph.org> | 2012-07-14 23:49:20 +0400 |
---|---|---|
committer | Gregory Maxwell <greg@xiph.org> | 2012-07-14 23:50:30 +0400 |
commit | d060dd7cbd6405c8a31510ca17adb1e051934f49 (patch) | |
tree | c93da8e9789914cf4f373723266a471c40cd02e5 | |
parent | ce878836864b1db3f2bf01575a36a2b230668bd8 (diff) |
Opus_multistream API hardening.
-rw-r--r-- | src/opus_multistream.c | 8 |
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; |