ref: 5da0498a3e23339aaceba659a97e935031d5693d
parent: abe8b7851346e498350d5ea0ef8238a634d4d754
author: Jean-Marc Valin <[email protected]>
date: Sat Jul 30 07:38:28 EDT 2016
Fixes overflow in CNG (found through fuzzing)
--- a/silk/CNG.c
+++ b/silk/CNG.c
@@ -170,7 +170,7 @@
}
/* Update states */
- CNG_sig_Q14[ MAX_LPC_ORDER + i ] = silk_ADD_LSHIFT( CNG_sig_Q14[ MAX_LPC_ORDER + i ], LPC_pred_Q10, 4 );
+ CNG_sig_Q14[ MAX_LPC_ORDER + i ] = silk_ADD_SAT32( CNG_sig_Q14[ MAX_LPC_ORDER + i ], silk_LSHIFT_SAT32( LPC_pred_Q10, 4 ) );
/* Scale with Gain and add to input signal */
frame[ i ] = (opus_int16)silk_ADD_SAT16( frame[ i ], silk_SAT16( silk_RSHIFT_ROUND( silk_SMULWW( CNG_sig_Q14[ MAX_LPC_ORDER + i ], gain_Q10 ), 8 ) ) );