shithub: opus

Download patch

ref: 69bcb28d3ddb20231580bd09e44d87a769dabcb7
parent: 3995a0c150511572280170280a348fab575edbe7
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Fri Mar 23 12:13:59 EDT 2018

Some missing checks

--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -769,6 +769,7 @@
       else
          return OPUS_INVALID_PACKET;
    }
+   celt_assert(st->channels == 1 || st->channels == 2);
    ALLOC(out, frame_size*st->channels, opus_int16);
 
    ret = opus_decode_native(st, data, len, out, frame_size, decode_fec, 0, NULL, 0);
@@ -806,6 +807,7 @@
       else
          return OPUS_INVALID_PACKET;
    }
+   celt_assert(st->channels == 1 || st->channels == 2);
    ALLOC(out, frame_size*st->channels, float);
 
    ret = opus_decode_native(st, data, len, out, frame_size, decode_fec, 0, NULL, 1);
--- a/src/opus_multistream_decoder.c
+++ b/src/opus_multistream_decoder.c
@@ -202,7 +202,7 @@
 
    VALIDATE_MS_DECODER(st);
    /* Limit frame_size to avoid excessive stack allocations. */
-   opus_multistream_decoder_ctl(st, OPUS_GET_SAMPLE_RATE(&Fs));
+   MUST_SUCCEED(opus_multistream_decoder_ctl(st, OPUS_GET_SAMPLE_RATE(&Fs)));
    frame_size = IMIN(frame_size, Fs/25*3);
    ALLOC(buf, 2*frame_size, opus_val16);
    ptr = (char*)st + align(sizeof(OpusMSDecoder));