aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2019-10-29 13:06:16 +0100
committerJean-Michel Trivi <jmtrivi@google.com>2019-12-27 09:01:22 -0800
commit089d368ddb5ce41c397fdd05034a1e67d519b836 (patch)
tree1c38edda2fb3ef9616b34f4ddda253422ddad27c
parent68cdcfc6b82f88ed1f616b7e3a0133b0072f4bf4 (diff)
downloadfdk-aac-089d368ddb5ce41c397fdd05034a1e67d519b836.tar.gz
fdk-aac-089d368ddb5ce41c397fdd05034a1e67d519b836.tar.bz2
fdk-aac-089d368ddb5ce41c397fdd05034a1e67d519b836.zip
Prevent signed integer overflows in ELD filterbank, multE2_DinvF_fdk().
Bug: 145669388 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: Iaba69b58666833c90e05b296c502ba6509a087a9
-rw-r--r--libAACdec/src/ldfiltbank.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/libAACdec/src/ldfiltbank.cpp b/libAACdec/src/ldfiltbank.cpp
index c7d2928..1898557 100644
--- a/libAACdec/src/ldfiltbank.cpp
+++ b/libAACdec/src/ldfiltbank.cpp
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -131,10 +131,12 @@ static void multE2_DinvF_fdk(FIXP_PCM *output, FIXP_DBL *x, const FIXP_WTB *fb,
FIXP_DBL z0, z2, tmp;
z2 = x[N / 2 + i];
- z0 = z2 + (fMultDiv2(z[N / 2 + i], fb[2 * N + i]) >> (-WTS2 - 1));
+ z0 = fAddSaturate(z2,
+ (fMultDiv2(z[N / 2 + i], fb[2 * N + i]) >> (-WTS2 - 1)));
- z[N / 2 + i] = x[N / 2 - 1 - i] +
- (fMultDiv2(z[N + i], fb[2 * N + N / 2 + i]) >> (-WTS2 - 1));
+ z[N / 2 + i] = fAddSaturate(
+ x[N / 2 - 1 - i],
+ (fMultDiv2(z[N + i], fb[2 * N + N / 2 + i]) >> (-WTS2 - 1)));
tmp = (fMultDiv2(z[N / 2 + i], fb[N + N / 2 - 1 - i]) +
fMultDiv2(z[i], fb[N + N / 2 + i]));
@@ -159,10 +161,12 @@ static void multE2_DinvF_fdk(FIXP_PCM *output, FIXP_DBL *x, const FIXP_WTB *fb,
FIXP_DBL z0, z2, tmp0, tmp1;
z2 = x[N / 2 + i];
- z0 = z2 + (fMultDiv2(z[N / 2 + i], fb[2 * N + i]) >> (-WTS2 - 1));
+ z0 = fAddSaturate(z2,
+ (fMultDiv2(z[N / 2 + i], fb[2 * N + i]) >> (-WTS2 - 1)));
- z[N / 2 + i] = x[N / 2 - 1 - i] +
- (fMultDiv2(z[N + i], fb[2 * N + N / 2 + i]) >> (-WTS2 - 1));
+ z[N / 2 + i] = fAddSaturate(
+ x[N / 2 - 1 - i],
+ (fMultDiv2(z[N + i], fb[2 * N + N / 2 + i]) >> (-WTS2 - 1)));
tmp0 = (fMultDiv2(z[N / 2 + i], fb[N / 2 - 1 - i]) +
fMultDiv2(z[i], fb[N / 2 + i]));