ref: d060dd7cbd6405c8a31510ca17adb1e051934f49
parent: ce878836864b1db3f2bf01575a36a2b230668bd8
author: Gregory Maxwell <[email protected]>
date: Sat Jul 14 11:49:20 EDT 2012
Opus_multistream API hardening.
--- a/src/opus_multistream.c
+++ b/src/opus_multistream.c
@@ -163,6 +163,10 @@
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;
@@ -533,6 +537,10 @@
int mono_size;
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;