shithub: opus

Download patch

ref: 337f34cf5b6d880ed66a1f1c69e96441693d3fba
parent: 8e3a1cbf4848567eb4c5b79d2855a00f87c7b9c2
author: Jean-Marc Valin <[email protected]>
date: Mon Jul 1 12:17:01 EDT 2013

Adds some checks to the surround API

--- a/src/opus_multistream_encoder.c
+++ b/src/opus_multistream_encoder.c
@@ -224,6 +224,8 @@
       int application
 )
 {
+   if ((channels>255) || (channels<1))
+      return OPUS_BAD_ARG;
    st->lfe_stream = -1;
    if (mapping_family==0)
    {
@@ -258,9 +260,8 @@
          mapping[i] = i;
    } else
       return OPUS_UNIMPLEMENTED;
-   opus_multistream_encoder_init_impl(st, Fs, channels, *streams, *coupled_streams,
+   return opus_multistream_encoder_init_impl(st, Fs, channels, *streams, *coupled_streams,
          mapping, application, channels>2&&mapping_family==1);
-   return OPUS_OK;
 }
 
 OpusMSEncoder *opus_multistream_encoder_create(