Constrains accumulated pitch gain to avoid potential instability.
[opus.git] / silk / log2lin.c
index 07d97a9..a692e00 100644 (file)
@@ -41,7 +41,9 @@ opus_int32 silk_log2lin(
 
     if( inLog_Q7 < 0 ) {
         return 0;
-    }
+    } else if ( inLog_Q7 >= 3967 ) {
+               return silk_int32_MAX;
+       }
 
     out = silk_LSHIFT( 1, silk_RSHIFT( inLog_Q7, 7 ) );
     frac_Q7 = inLog_Q7 & 0x7F;