diff --git a/src/opus_decoder.c b/src/opus_decoder.c index eb4c70363e10f9737fb37dff90da76b6dd04bd89..4c7d17900618a6d9cb7df4c0a41dd65f25f09045 100644 --- a/src/opus_decoder.c +++ b/src/opus_decoder.c @@ -398,6 +398,22 @@ int opus_decode(OpusDecoder *st, const unsigned char *data, if (st->frame_size*count*25 > 3*st->Fs) return OPUS_CORRUPTED_DATA; len--; + /* Padding bit */ + if (ch&0x40) + { + int padding=0; + int p; + do { + if (len<=0) + return OPUS_CORRUPTED_DATA; + p = *data++; + len--; + padding += p==255 ? 254: p; + } while (p==255); + len -= padding; + } + if (len<0) + return OPUS_CORRUPTED_DATA; /* Bit 7 is VBR flag (bit 6 is ignored) */ if (ch&0x80) {