Prevent signed integer overflows in CLpd_FAC_Mdct2Acelp().

Bug: 131430997
Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc
Change-Id: I348fe4be577ac39f961352902d138a8e07982096
This commit is contained in:
Fraunhofer IIS FDK 2019-10-18 14:04:50 +02:00 committed by Jean-Michel Trivi
parent b8f7bab39c
commit ade11a1d6f
1 changed files with 3 additions and 3 deletions

View File

@ -344,7 +344,7 @@ INT CLpd_FAC_Mdct2Acelp(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *pFac,
/* Overlap Add */ /* Overlap Add */
x0 = -fMult(*pOvl--, pWindow[i].v.re); x0 = -fMult(*pOvl--, pWindow[i].v.re);
*pOut0 += IMDCT_SCALE_DBL(x0); *pOut0 = fAddSaturate(*pOut0, IMDCT_SCALE_DBL(x0));
pOut0++; pOut0++;
} }
} else { } else {
@ -354,7 +354,7 @@ INT CLpd_FAC_Mdct2Acelp(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *pFac,
/* Overlap Add */ /* Overlap Add */
x0 = fMult(*pOvl--, pWindow[i].v.re); x0 = fMult(*pOvl--, pWindow[i].v.re);
*pOut0 += IMDCT_SCALE_DBL(x0); *pOut0 = fAddSaturate(*pOut0, IMDCT_SCALE_DBL(x0));
pOut0++; pOut0++;
} }
} }
@ -362,7 +362,7 @@ INT CLpd_FAC_Mdct2Acelp(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *pFac,
0) { /* this should only happen for ACELP -> TCX20 -> ACELP transition */ 0) { /* this should only happen for ACELP -> TCX20 -> ACELP transition */
FIXP_DBL *pOut = pOut0 - fl / 2; /* fl/2 == fac_length */ FIXP_DBL *pOut = pOut0 - fl / 2; /* fl/2 == fac_length */
for (i = 0; i < fl / 2; i++) { for (i = 0; i < fl / 2; i++) {
pOut[i] += IMDCT_SCALE_DBL(hMdct->pFacZir[i]); pOut[i] = fAddSaturate(pOut[i], IMDCT_SCALE_DBL(hMdct->pFacZir[i]));
} }
hMdct->pFacZir = NULL; hMdct->pFacZir = NULL;
} }