From f451b33b16b86789f7d5d6791cdbae7db9c6d62d Mon Sep 17 00:00:00 2001 From: Gregory Maxwell <greg@xiph.org> Date: Sun, 4 Sep 2011 10:47:15 -0400 Subject: [PATCH] Sanitize input to opus_en/decoder_get_size. --- src/opus_decoder.c | 2 ++ src/opus_encoder.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/opus_decoder.c b/src/opus_decoder.c index bb1612fbf..99ae48d63 100644 --- a/src/opus_decoder.c +++ b/src/opus_decoder.c @@ -70,6 +70,8 @@ int opus_decoder_get_size(int channels) { int silkDecSizeBytes, celtDecSizeBytes; int ret; + if (channels<1 || channels > 2) + return 0; ret = silk_Get_Decoder_Size( &silkDecSizeBytes ); if(ret) return 0; diff --git a/src/opus_encoder.c b/src/opus_encoder.c index 6b4702da4..ef62b9185 100644 --- a/src/opus_encoder.c +++ b/src/opus_encoder.c @@ -124,6 +124,8 @@ int opus_encoder_get_size(int channels) { int silkEncSizeBytes, celtEncSizeBytes; int ret; + if (channels<1 || channels > 2) + return 0; ret = silk_Get_Encoder_Size( &silkEncSizeBytes ); if (ret) return 0; -- GitLab