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;