diff options
author | Fraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de> | 2021-05-07 20:41:39 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-05-07 20:41:39 +0000 |
commit | 675de1faf282fc65a4b9d8529b2ef85d99c00764 (patch) | |
tree | be6addfcb5abcb7d74485a120e29a3107e11827e | |
parent | ec3a5114d9ebb2153a2dfec9d720ad2a021ec5a9 (diff) | |
parent | 85a3977fdfd1c73c2d0cc6b26f8dfa29a7cfd780 (diff) | |
download | fdk-aac-675de1faf282fc65a4b9d8529b2ef85d99c00764.tar.gz fdk-aac-675de1faf282fc65a4b9d8529b2ef85d99c00764.tar.bz2 fdk-aac-675de1faf282fc65a4b9d8529b2ef85d99c00764.zip |
Fix fixmadddiv2_DD() integer overflow in SpatialDecApplyM2_Mode212_ResidualsPlusPhaseCoding(). am: 85a3977fdf
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/14470256
Change-Id: Ic04dff8bffc77eb7a178f816b9f67af1381f5a81
-rw-r--r-- | libSACdec/src/sac_process.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/libSACdec/src/sac_process.cpp b/libSACdec/src/sac_process.cpp index 22091a9..33a1647 100644 --- a/libSACdec/src/sac_process.cpp +++ b/libSACdec/src/sac_process.cpp @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten +© Copyright 1995 - 2021 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -517,12 +517,11 @@ SACDEC_ERROR SpatialDecApplyM2_Mode212_ResidualsPlusPhaseCoding( maxVal = fAbs(iReal0) | fAbs(iImag0); maxVal |= fAbs(iReal1); - s = fMax(CntLeadingZeros(maxVal) - 1, 0); - s = fMin(s, scale_param_m2); + s = fMin(CntLeadingZeros(maxVal) - 2, scale_param_m2); - mReal0 = iReal0 << s; - mImag0 = iImag0 << s; - mReal1 = iReal1 << s; + mReal0 = scaleValue(iReal0, s); + mImag0 = scaleValue(iImag0, s); + mReal1 = scaleValue(iReal1, s); s = scale_param_m2 - s; @@ -562,12 +561,11 @@ SACDEC_ERROR SpatialDecApplyM2_Mode212_ResidualsPlusPhaseCoding( maxVal = fAbs(iReal0) | fAbs(iImag0); maxVal |= fAbs(iReal1); - s = fMax(CntLeadingZeros(maxVal) - 1, 0); - s = fMin(s, scale_param_m2); + s = fMin(CntLeadingZeros(maxVal) - 2, scale_param_m2); - mReal0 = FX_DBL2FX_SGL(iReal0 << s); - mImag0 = FX_DBL2FX_SGL(iImag0 << s); - mReal1 = FX_DBL2FX_SGL(iReal1 << s); + mReal0 = FX_DBL2FX_SGL(scaleValue(iReal0, s)); + mImag0 = FX_DBL2FX_SGL(scaleValue(iImag0, s)); + mReal1 = FX_DBL2FX_SGL(scaleValue(iReal1, s)); s = scale_param_m2 - s; |