diff options
author | Koen Vos <koenvos@users.noreply.github.com> | 2016-02-19 06:35:55 +0300 |
---|---|---|
committer | Koen Vos <koenvos@users.noreply.github.com> | 2016-02-19 06:35:55 +0300 |
commit | c9cedccfbe7f97903d4d80cddc98c4c8df08ffb4 (patch) | |
tree | 2c37ae91a8bb6849774f39db81c2c687499b58eb | |
parent | 8887ce85a675bbd1ed133c1c1dc2a452a9bdd134 (diff) |
fixes bug in sum_sqr_shift where overflow could happen for the last sample of an odd-length frame
-rw-r--r-- | silk/sum_sqr_shift.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/silk/sum_sqr_shift.c b/silk/sum_sqr_shift.c index f5bb6c8b..e387391a 100644 --- a/silk/sum_sqr_shift.c +++ b/silk/sum_sqr_shift.c @@ -73,10 +73,11 @@ void silk_sum_sqr_shift( } /* Make sure to have at least 10% headroom */ - if( nrg > SILK_FIX_CONST( 0.9, 31 ) ) { + if( (opus_uint32)nrg > SILK_FIX_CONST( 0.9, 31 ) ) { nrg = silk_RSHIFT_uint( (opus_uint32)nrg, 1 ); shft++; } + silk_assert( nrg >= 0 ); /* Output arguments */ *shift = shft; |