aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2019-10-18 14:04:15 +0200
committerJean-Michel Trivi <jmtrivi@google.com>2019-10-18 10:58:01 -0700
commit920ecc7487645192e9b9dee7c5261b5ff8b81be9 (patch)
tree10721240071bba263b3d2b399d9d5ea9341fba73
parent3634955ca5efcfe7a8565ef1ba676531b3123ca1 (diff)
downloadfdk-aac-920ecc7487645192e9b9dee7c5261b5ff8b81be9.tar.gz
fdk-aac-920ecc7487645192e9b9dee7c5261b5ff8b81be9.tar.bz2
fdk-aac-920ecc7487645192e9b9dee7c5261b5ff8b81be9.zip
Prevent signed integer overflows in CLpd_FAC_Acelp2Mdct().
Bug: 131430997 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: I216f97b0c75a9076f3963036b098af37b390c5bb
-rw-r--r--libAACdec/src/usacdec_fac.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/libAACdec/src/usacdec_fac.cpp b/libAACdec/src/usacdec_fac.cpp
index 0e28fbb..3c0b1ce 100644
--- a/libAACdec/src/usacdec_fac.cpp
+++ b/libAACdec/src/usacdec_fac.cpp
@@ -493,9 +493,7 @@ INT CLpd_FAC_Acelp2Mdct(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *_pSpec,
/* Div2 is compensated by table scaling */
x = fMultDiv2(pTmp2[i], FacWindowZir[w]);
x += fMultDiv2(pTmp1[-i - 1], FacWindowSynth[w]);
- x += pFAC_and_FAC_ZIR[i];
- pOut1[i] = x;
-
+ pOut1[i] = fAddSaturate(x, pFAC_and_FAC_ZIR[i]);
w++;
}
}
@@ -552,7 +550,7 @@ INT CLpd_FAC_Acelp2Mdct(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *_pSpec,
FDK_ASSERT((pOut1 >= hMdct->overlap.time &&
pOut1 < hMdct->overlap.time + hMdct->ov_size) ||
(pOut1 >= output && pOut1 < output + 1024));
- *pOut1 += IMDCT_SCALE_DBL(-x1);
+ *pOut1 = fAddSaturate(*pOut1, IMDCT_SCALE_DBL(-x1));
pOut1--;
}
@@ -578,7 +576,7 @@ INT CLpd_FAC_Acelp2Mdct(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *_pSpec,
FIXP_DBL x = -(*pCurr--);
/* 5) (item 4) Synthesis filter Zir component, FAC ZIR (another one). */
if (i < f_len) {
- x += *pF++;
+ x = fAddSaturate(x, *pF++);
}
FDK_ASSERT((pOut1 >= hMdct->overlap.time &&
@@ -705,7 +703,7 @@ INT CLpd_FAC_Acelp2Mdct(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *_pSpec,
FIXP_DBL *pOut = pOut0 - fl / 2;
FDK_ASSERT(fl / 2 <= 128);
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;
}