summaryrefslogtreecommitdiff
path: root/silk/LPC_fit.c
diff options
context:
space:
mode:
authorFelicia Lim <flim@google.com>2021-02-22 22:29:14 -0800
committerFelicia Lim <flim@google.com>2021-03-02 21:35:16 -0800
commit7b05f44f4baadf34d8d1073f4ff69f1806d5cdb4 (patch)
treea39ed67321c97dd8a60dcefb347a48cbbf7caa7e /silk/LPC_fit.c
parent16286a25fdd865c66a837a73b65fbaa7b25bf484 (diff)
downloadopus-7b05f44f4baadf34d8d1073f4ff69f1806d5cdb4.tar.gz
celt_lpc: avoid overflows when computing lpcs in fixed point
The LPCs are computed in 32-bit, so increase the allowed range from +/-8 to +/-64 to avoid overflows caught during fuzzing. Before downshifting back down to the +/-8 range in the final 16-bit output, perform bandwidth extension to avoid any additional overflow issues.
Diffstat (limited to 'silk/LPC_fit.c')
-rw-r--r--silk/LPC_fit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/silk/LPC_fit.c b/silk/LPC_fit.c
index cdea4f3a..c0690a1f 100644
--- a/silk/LPC_fit.c
+++ b/silk/LPC_fit.c
@@ -31,7 +31,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "SigProc_FIX.h"
-/* Convert int32 coefficients to int16 coefs and make sure there's no wrap-around */
+/* Convert int32 coefficients to int16 coefs and make sure there's no wrap-around.
+ This logic is reused in _celt_lpc(). Any bug fixes should also be applied there. */
void silk_LPC_fit(
opus_int16 *a_QOUT, /* O Output signal */
opus_int32 *a_QIN, /* I/O Input signal */