diff options
author | Fraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de> | 2019-09-20 14:01:32 +0200 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2019-10-15 15:49:00 -0700 |
commit | 2d292e9b2d116934f09e37c6553927582c9ee4fc (patch) | |
tree | 39a77c00e755d08765acbe0ffc5fb70fc25b3e30 | |
parent | 4c839c6a90d800d60f66f848f437ccdd800953a9 (diff) | |
download | fdk-aac-2d292e9b2d116934f09e37c6553927582c9ee4fc.tar.gz fdk-aac-2d292e9b2d116934f09e37c6553927582c9ee4fc.tar.bz2 fdk-aac-2d292e9b2d116934f09e37c6553927582c9ee4fc.zip |
Use SATURATE_LEFT_SHIFT in get_lsppol() to prevent integer overflow.
Bug: 131430997
Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc
Change-Id: Ie9ec52485a52b076a900b111b035289110c004f8
-rw-r--r-- | libAACdec/src/usacdec_lpc.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libAACdec/src/usacdec_lpc.cpp b/libAACdec/src/usacdec_lpc.cpp index 271463f..440fa87 100644 --- a/libAACdec/src/usacdec_lpc.cpp +++ b/libAACdec/src/usacdec_lpc.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 @@ -1138,9 +1138,12 @@ static void get_lsppol(FIXP_LPC lsp[], FIXP_DBL f[], int n, int flag) { for (i = 2; i <= n; i++) { plsp += 2; b = -FX_LPC2FX_DBL(*plsp); - f[i] = ((fMultDiv2(b, f[i - 1]) << 1) + (f[i - 2])) << 1; + f[i] = SATURATE_LEFT_SHIFT((fMultDiv2(b, f[i - 1]) + (f[i - 2] >> 1)), 2, + DFRACT_BITS); for (j = i - 1; j > 1; j--) { - f[j] = f[j] + (fMultDiv2(b, f[j - 1]) << 2) + f[j - 2]; + f[j] = SATURATE_LEFT_SHIFT( + ((f[j] >> 2) + fMultDiv2(b, f[j - 1]) + (f[j - 2] >> 2)), 2, + DFRACT_BITS); } f[1] = f[1] + (b >> (SF_F - 1)); } |