aboutsummaryrefslogtreecommitdiffstats
path: root/libAACdec/src/usacdec_acelp.cpp
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2018-06-29 16:33:30 +0200
committerJean-Michel Trivi <jmtrivi@google.com>2018-12-26 19:19:34 -0500
commit8166502969e261270d098146c3fcae37d92d3c50 (patch)
treeb9dde5f7f2572b4184ea2e80733f6efa5d3329a0 /libAACdec/src/usacdec_acelp.cpp
parentf59fd73d4443b015b11a362c807f6b828658a799 (diff)
downloadfdk-aac-8166502969e261270d098146c3fcae37d92d3c50.tar.gz
fdk-aac-8166502969e261270d098146c3fcae37d92d3c50.tar.bz2
fdk-aac-8166502969e261270d098146c3fcae37d92d3c50.zip
Prevent overflow in usac filters
Bug: 112663886 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: Ie7af65a1a556afb141ea5272f70bfea11881ac30
Diffstat (limited to 'libAACdec/src/usacdec_acelp.cpp')
-rw-r--r--libAACdec/src/usacdec_acelp.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/libAACdec/src/usacdec_acelp.cpp b/libAACdec/src/usacdec_acelp.cpp
index af1f488..9fecebf 100644
--- a/libAACdec/src/usacdec_acelp.cpp
+++ b/libAACdec/src/usacdec_acelp.cpp
@@ -579,11 +579,11 @@ void Syn_filt(const FIXP_LPC a[], /* (i) : a[m] prediction coefficients Q12 */
L_tmp = (FIXP_DBL)0;
for (j = 0; j < M_LP_FILTER_ORDER; j++) {
- L_tmp -= fMultDiv2(a[j], y[i - (j + 1)]);
+ L_tmp -= fMultDiv2(a[j], y[i - (j + 1)]) >> (LP_FILTER_SCALE - 1);
}
- L_tmp = scaleValue(L_tmp, a_exp + 1);
- y[i] = L_tmp + x[i];
+ L_tmp = scaleValue(L_tmp, a_exp + LP_FILTER_SCALE);
+ y[i] = fAddSaturate(L_tmp, x[i]);
}
return;
@@ -631,10 +631,10 @@ void E_UTIL_residu(const FIXP_LPC *a, const INT a_exp, FIXP_DBL *x, FIXP_DBL *y,
s = (FIXP_DBL)0;
for (j = 0; j < M_LP_FILTER_ORDER; j++) {
- s += fMultDiv2(a[j], x[i - j - 1]);
+ s += fMultDiv2(a[j], x[i - j - 1]) >> (LP_FILTER_SCALE - 1);
}
- s = scaleValue(s, a_exp + 1);
+ s = scaleValue(s, a_exp + LP_FILTER_SCALE);
y[i] = fAddSaturate(s, x[i]);
}