diff --git a/celt/bands.c b/celt/bands.c index 61e2d4ca68cd2f89915bb3987ccd1b1ca6e35775..90ac6a229ecfd64c90fa486dcfa39299ac0b9737 100644 --- a/celt/bands.c +++ b/celt/bands.c @@ -241,10 +241,10 @@ void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X, /* Handle extreme gains with negative shift. */ if (shift<0) { - /* For shift < -2 we'd be likely to overflow, so we're capping - the gain here. This shouldn't happen unless the bitstream is - already corrupted. */ - if (shift < -2) + /* For shift <= -2 and g > 16384 we'd be likely to overflow, so we're + capping the gain here, which is equivalent to a cap of 18 on lg. + This shouldn't trigger unless the bitstream is already corrupted. */ + if (shift <= -2) { g = 16384; shift = -2;