Skip to content
Snippets Groups Projects
Commit f451b33b authored by Gregory Maxwell's avatar Gregory Maxwell
Browse files

Sanitize input to opus_en/decoder_get_size.

parent 50ef21c0
No related branches found
No related tags found
No related merge requests found
...@@ -70,6 +70,8 @@ int opus_decoder_get_size(int channels) ...@@ -70,6 +70,8 @@ int opus_decoder_get_size(int channels)
{ {
int silkDecSizeBytes, celtDecSizeBytes; int silkDecSizeBytes, celtDecSizeBytes;
int ret; int ret;
if (channels<1 || channels > 2)
return 0;
ret = silk_Get_Decoder_Size( &silkDecSizeBytes ); ret = silk_Get_Decoder_Size( &silkDecSizeBytes );
if(ret) if(ret)
return 0; return 0;
......
...@@ -124,6 +124,8 @@ int opus_encoder_get_size(int channels) ...@@ -124,6 +124,8 @@ int opus_encoder_get_size(int channels)
{ {
int silkEncSizeBytes, celtEncSizeBytes; int silkEncSizeBytes, celtEncSizeBytes;
int ret; int ret;
if (channels<1 || channels > 2)
return 0;
ret = silk_Get_Encoder_Size( &silkEncSizeBytes ); ret = silk_Get_Encoder_Size( &silkEncSizeBytes );
if (ret) if (ret)
return 0; return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment