aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2019-09-20 14:02:19 +0200
committerJean-Michel Trivi <jmtrivi@google.com>2019-10-15 15:49:23 -0700
commit4db9f39f6d1a4f89e3891d29345201a04eef43f0 (patch)
tree5bcf9b7ec2af7c57a1ccfa4ec9764ff9d0fbb3df
parent2d292e9b2d116934f09e37c6553927582c9ee4fc (diff)
downloadfdk-aac-4db9f39f6d1a4f89e3891d29345201a04eef43f0.tar.gz
fdk-aac-4db9f39f6d1a4f89e3891d29345201a04eef43f0.tar.bz2
fdk-aac-4db9f39f6d1a4f89e3891d29345201a04eef43f0.zip
Avoid signed integer overflow in E_LPC_f_lsp_a_conversion().
Bug: 131430997 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: If2110ad246bb5b57ef76c9cd251874ecd4b05109
-rw-r--r--libAACdec/src/usacdec_lpc.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/libAACdec/src/usacdec_lpc.cpp b/libAACdec/src/usacdec_lpc.cpp
index 440fa87..278afbe 100644
--- a/libAACdec/src/usacdec_lpc.cpp
+++ b/libAACdec/src/usacdec_lpc.cpp
@@ -1170,6 +1170,9 @@ void E_LPC_f_lsp_a_conversion(FIXP_LPC *lsp, FIXP_LPC *a, INT *a_exp) {
/*-----------------------------------------------------*
* Multiply F1(z) by (1+z^-1) and F2(z) by (1-z^-1) *
*-----------------------------------------------------*/
+ scaleValues(f1, NC + 1, -2);
+ scaleValues(f2, NC + 1, -2);
+
for (i = NC; i > 0; i--) {
f1[i] += f1[i - 1];
f2[i] -= f2[i - 1];
@@ -1178,13 +1181,8 @@ void E_LPC_f_lsp_a_conversion(FIXP_LPC *lsp, FIXP_LPC *a, INT *a_exp) {
FIXP_DBL aDBL[M_LP_FILTER_ORDER];
for (i = 1, k = M_LP_FILTER_ORDER - 1; i <= NC; i++, k--) {
- FIXP_DBL tmp1, tmp2;
-
- tmp1 = f1[i] >> 1;
- tmp2 = f2[i] >> 1;
-
- aDBL[i - 1] = (tmp1 + tmp2);
- aDBL[k] = (tmp1 - tmp2);
+ aDBL[i - 1] = f1[i] + f2[i];
+ aDBL[k] = f1[i] - f2[i];
}
int headroom_a = getScalefactor(aDBL, M_LP_FILTER_ORDER);
@@ -1193,5 +1191,5 @@ void E_LPC_f_lsp_a_conversion(FIXP_LPC *lsp, FIXP_LPC *a, INT *a_exp) {
a[i] = FX_DBL2FX_LPC(aDBL[i] << headroom_a);
}
- *a_exp = 8 - headroom_a;
+ *a_exp = SF_F + (2 - 1) - headroom_a;
}