diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2018-02-16 12:36:44 -0500 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2018-02-16 12:38:15 -0500 |
commit | cc2bf69bef8040dcfaf40a13c75248c84210ea9d (patch) | |
tree | e04b0341fa33b81cbc68e3a1941af9bdc06eadc6 | |
parent | daf9503472faad50a49e03ccda0f840d8261f4c1 (diff) | |
download | opus-exp_hybrid_lbr1.tar.gz |
Fixes integer overflow in SILK VAD for 10-ms framesexp_hybrid_lbr1
Reported by Chandrakala Madhira on the mailing list
-rw-r--r-- | silk/VAD.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -252,15 +252,14 @@ opus_int silk_VAD_GetSA_Q8_c( /* O Return v speech_nrg += ( b + 1 ) * silk_RSHIFT( Xnrg[ b ] - psSilk_VAD->NL[ b ], 4 ); } + if( psEncC->frame_length == 20 * psEncC->fs_kHz ) { + speech_nrg = silk_RSHIFT32( speech_nrg, 1 ); + } /* Power scaling */ if( speech_nrg <= 0 ) { SA_Q15 = silk_RSHIFT( SA_Q15, 1 ); - } else if( speech_nrg < 32768 ) { - if( psEncC->frame_length == 10 * psEncC->fs_kHz ) { - speech_nrg = silk_LSHIFT_SAT32( speech_nrg, 16 ); - } else { - speech_nrg = silk_LSHIFT_SAT32( speech_nrg, 15 ); - } + } else if( speech_nrg < 16384 ) { + speech_nrg = silk_LSHIFT_SAT32( speech_nrg, 16 ); /* square-root */ speech_nrg = silk_SQRT_APPROX( speech_nrg ); |