aboutsummaryrefslogtreecommitdiffstats
path: root/libAACdec
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2019-10-18 14:03:39 +0200
committerJean-Michel Trivi <jmtrivi@google.com>2019-10-18 10:57:23 -0700
commitf22eb9c1fa5bc594e6468a00566c11fc00654394 (patch)
treee2f2e18b6a3b43b16b5214d3937c847960c72a8a /libAACdec
parentea9d3a049b7b3bb1a9523fe8cf79375140856359 (diff)
downloadfdk-aac-f22eb9c1fa5bc594e6468a00566c11fc00654394.tar.gz
fdk-aac-f22eb9c1fa5bc594e6468a00566c11fc00654394.tar.bz2
fdk-aac-f22eb9c1fa5bc594e6468a00566c11fc00654394.zip
Avoid signed integer overflow in bass_pf_1sf_delay().
Bug: 131430997 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: I67bfab71987b31601a4666c8cf292f71bcb6799a
Diffstat (limited to 'libAACdec')
-rw-r--r--libAACdec/src/usacdec_lpd.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/libAACdec/src/usacdec_lpd.cpp b/libAACdec/src/usacdec_lpd.cpp
index fa68ccb..5c3426d 100644
--- a/libAACdec/src/usacdec_lpd.cpp
+++ b/libAACdec/src/usacdec_lpd.cpp
@@ -336,17 +336,22 @@ void bass_pf_1sf_delay(
{
for (i = 0; i < lg; i++) {
- /* scaled with SF_SYNTH + gain_sf + 1 */
+ /* scaled with SF_SYNTH + gain_sf + 1; composition of scalefactor 2:
+ * one additional shift of syn values + fMult => fMultDiv2 */
noise_in[i] =
- (fMult(gainSGL, syn[i + i_subfr] - (syn[i + i_subfr - T] >> 1) -
- (syn[i + i_subfr + T] >> 1))) >>
- s1;
+ scaleValue(fMultDiv2(gainSGL, (syn[i + i_subfr] >> 1) -
+ (syn[i + i_subfr - T] >> 2) -
+ (syn[i + i_subfr + T] >> 2)),
+ 2 - s1);
}
for (i = lg; i < L_SUBFR; i++) {
- /* scaled with SF_SYNTH + gain_sf + 1 */
+ /* scaled with SF_SYNTH + gain_sf + 1; composition of scalefactor 2:
+ * one additional shift of syn values + fMult => fMultDiv2 */
noise_in[i] =
- (fMult(gainSGL, syn[i + i_subfr] - syn[i + i_subfr - T])) >> s1;
+ scaleValue(fMultDiv2(gainSGL, (syn[i + i_subfr] >> 1) -
+ (syn[i + i_subfr - T] >> 1)),
+ 2 - s1);
}
}
} else {