Making it clearer to Coverity that nStates cannot exceed NLSF_QUANT_DEL_DEC_STATES
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Fri, 5 Aug 2016 21:15:14 +0000 (17:15 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Fri, 5 Aug 2016 21:15:14 +0000 (17:15 -0400)
silk/NLSF_del_dec_quant.c

index 251ca11..5155cae 100644 (file)
@@ -131,7 +131,7 @@ opus_int32 silk_NLSF_del_dec_quant(                             /* O    Returns
             RD_Q25[ j + nStates ] = silk_SMLABB( silk_MLA( RD_tmp_Q25, silk_SMULBB( diff_Q10, diff_Q10 ), w_Q5[ i ] ), mu_Q20, rate1_Q5 );
         }
 
-        if( nStates < NLSF_QUANT_DEL_DEC_STATES ) {
+        if( silk_LSHIFT( nStates, 1 ) <= NLSF_QUANT_DEL_DEC_STATES ) {
             /* double number of states and copy */
             for( j = 0; j < nStates; j++ ) {
                 ind[ j + nStates ][ i ] = ind[ j ][ i ] + 1;