diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2016-07-24 20:29:51 -0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2016-07-24 20:30:33 -0400 |
commit | fe6f9666ca1f20d3397b9157423ccca203b3b059 (patch) | |
tree | 8efd9c00b26e59e3dd078aded38e0ff77e078f09 | |
parent | efaffa46d438100938ef5805170efc58673a1b3c (diff) | |
download | opus-exp_overflow6.tar.gz |
Fixes cap on gain in denormalise_bands()exp_overflow6
-rw-r--r-- | celt/bands.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/celt/bands.c b/celt/bands.c index 362a2a74..90ac6a22 100644 --- a/celt/bands.c +++ b/celt/bands.c @@ -241,12 +241,12 @@ 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 = 32767; + g = 16384; shift = -2; } do { |