diff options
author | Niclas Olmenius <niclas@voysys.se> | 2020-02-19 15:58:35 +0300 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2020-04-13 10:09:05 +0300 |
commit | 06a651547f4a197c29b6abc23b530833855ee358 (patch) | |
tree | 30a4a0e81abcc87ac009ec1b0b377d869f7b1b1d | |
parent | adcb7bc21d0afa79c1975030b29dfeef76651839 (diff) |
Fix celt decoder assertion when using OPUS_CUSTOM
When using OPUS_CUSTOM, `CELTDecoder->end` can be larger than 21.
Assert against 25 instead in OPUS_CUSTOM builds.
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
-rw-r--r-- | celt/celt_decoder.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/celt/celt_decoder.c b/celt/celt_decoder.c index e6efce93..74ca3b74 100644 --- a/celt/celt_decoder.c +++ b/celt/celt_decoder.c @@ -117,13 +117,19 @@ void validate_celt_decoder(CELTDecoder *st) #ifndef CUSTOM_MODES celt_assert(st->mode == opus_custom_mode_create(48000, 960, NULL)); celt_assert(st->overlap == 120); + celt_assert(st->end <= 21); +#else +/* From Section 4.3 in the spec: "The normal CELT layer uses 21 of those bands, + though Opus Custom (see Section 6.2) may use a different number of bands" + + Check if it's within the maximum number of Bark frequency bands instead */ + celt_assert(st->end <= 25); #endif celt_assert(st->channels == 1 || st->channels == 2); celt_assert(st->stream_channels == 1 || st->stream_channels == 2); celt_assert(st->downsample > 0); celt_assert(st->start == 0 || st->start == 17); celt_assert(st->start < st->end); - celt_assert(st->end <= 21); #ifdef OPUS_ARCHMASK celt_assert(st->arch >= 0); celt_assert(st->arch <= OPUS_ARCHMASK); |