From f22eb9c1fa5bc594e6468a00566c11fc00654394 Mon Sep 17 00:00:00 2001 From: Fraunhofer IIS FDK Date: Fri, 18 Oct 2019 14:03:39 +0200 Subject: Avoid signed integer overflow in bass_pf_1sf_delay(). Bug: 131430997 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: I67bfab71987b31601a4666c8cf292f71bcb6799a --- libAACdec/src/usacdec_lpd.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'libAACdec') 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 { -- cgit v1.2.3