shithub: opus

Download patch

ref: 594c4d8e9d60bdcd2244a68517a81998e03efb84
parent: 646fcc33d7fee7fbca5a6ef82d0f6bd5233ff39f
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Fri Jul 22 10:25:03 EDT 2016

Increase headroom to avoid overflow in silk_pitch_analysis_core()

--- a/silk/fixed/pitch_analysis_core_FIX.c
+++ b/silk/fixed/pitch_analysis_core_FIX.c
@@ -141,7 +141,7 @@
 
     /* Downscale input if necessary */
     silk_sum_sqr_shift( &energy, &shift, frame_unscaled, frame_length );
-    shift += 2 - silk_CLZ32( energy );        /* at least one bit headroom */
+    shift += 3 - silk_CLZ32( energy );        /* at least two bits headroom */
     ALLOC( frame_scaled, frame_length, opus_int16 );
     if( shift > 0 ) {
         shift = silk_RSHIFT( shift + 1, 1 );