From 7b05f44f4baadf34d8d1073f4ff69f1806d5cdb4 Mon Sep 17 00:00:00 2001 From: Felicia Lim Date: Mon, 22 Feb 2021 22:29:14 -0800 Subject: 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. --- silk/LPC_fit.c | 3 ++- silk/bwexpander_32.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'silk') 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 */ diff --git a/silk/bwexpander_32.c b/silk/bwexpander_32.c index d0010f73..0f32b9df 100644 --- a/silk/bwexpander_32.c +++ b/silk/bwexpander_32.c @@ -31,7 +31,8 @@ POSSIBILITY OF SUCH DAMAGE. #include "SigProc_FIX.h" -/* Chirp (bandwidth expand) LP AR filter */ +/* Chirp (bandwidth expand) LP AR filter. + This logic is reused in _celt_lpc(). Any bug fixes should also be applied there. */ void silk_bwexpander_32( opus_int32 *ar, /* I/O AR filter to be expanded (without leading 1) */ const opus_int d, /* I Length of ar */ -- cgit v1.2.3