Fix for integer overflow in ixheaacd_cplx_synt_qmffilt

Added saturation checks to avoid integer overflow.

Bug: 158398386
Test: poc in bug

Change-Id: Ib4f10e07a4c6069452d38e87413fac755c056bae
This commit is contained in:
Rajat Kumar 2020-06-10 17:25:36 +05:30 committed by rajat.kumar@ittiam.com
parent bcbd383251
commit 8ba7e99fb3
2 changed files with 5 additions and 5 deletions

View file

@ -156,8 +156,8 @@ static PLATFORM_INLINE WORD32 ixheaacd_mac32x16in32_shl(WORD32 a, WORD32 b,
return (result);
}
static PLATFORM_INLINE WORD32 mac32x16in32_shl_sat(WORD32 a, WORD32 b,
WORD16 c) {
static PLATFORM_INLINE WORD32 ixheaacd_mac32x16in32_shl_sat(WORD32 a, WORD32 b,
WORD16 c) {
return (ixheaacd_add32_sat(a, ixheaacd_mult32x16in32_shl_sat(b, c)));
}

View file

@ -666,10 +666,10 @@ void ixheaacd_sbr_pre_twiddle(WORD32 *p_xre, WORD32 *p_xim,
WORD32 re, im;
re = ixheaacd_mac32x16in32_shl(
re = ixheaacd_mac32x16in32_shl_sat(
ixheaacd_mult32x16in32_shl(x_re, ixheaacd_cosine), x_im, ixheaacd_sine);
im = ixheaacd_sub32(ixheaacd_mult32x16in32_shl(x_im, ixheaacd_cosine),
ixheaacd_mult32x16in32_shl(x_re, ixheaacd_sine));
im = ixheaacd_sub32_sat(ixheaacd_mult32x16in32_shl(x_im, ixheaacd_cosine),
ixheaacd_mult32x16in32_shl(x_re, ixheaacd_sine));
*p_xre++ = re;
*p_xim++ = im;