aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2021-05-01 00:15:00 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-05-01 00:15:00 +0000
commit2a7cf2dc046a5d4bfff828eafee3b850e8a81b88 (patch)
tree7ff384d92bb6caf2ad80e9b9702366ab639a95c2
parent6d1f1ebaab15d871d24dbedd02176ba7ead486bf (diff)
parentab332a940d511e4995ca1b9f8051a5093f4828bd (diff)
downloadfdk-aac-2a7cf2dc046a5d4bfff828eafee3b850e8a81b88.tar.gz
fdk-aac-2a7cf2dc046a5d4bfff828eafee3b850e8a81b88.tar.bz2
fdk-aac-2a7cf2dc046a5d4bfff828eafee3b850e8a81b88.zip
Merge "Avoid signed integer overflow in combineSignalCplxScale2()." into sc-dev am: ab332a940d
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/14387474 Change-Id: I9260146d48ff100437308a2138942fdc1cc785a2
-rw-r--r--libSACdec/src/sac_stp.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/libSACdec/src/sac_stp.cpp b/libSACdec/src/sac_stp.cpp
index b328c82..be332c7 100644
--- a/libSACdec/src/sac_stp.cpp
+++ b/libSACdec/src/sac_stp.cpp
@@ -252,12 +252,15 @@ inline void combineSignalCplxScale2(FIXP_DBL *hybOutputRealDry,
int n;
for (n = bands - 1; n >= 0; n--) {
- *hybOutputRealDry =
- *hybOutputRealDry +
- (fMultDiv2(*hybOutputRealWet, scaleX) << (SF_SCALE + 1));
- *hybOutputImagDry =
- *hybOutputImagDry +
- (fMultDiv2(*hybOutputImagWet, scaleX) << (SF_SCALE + 1));
+ *hybOutputRealDry = SATURATE_LEFT_SHIFT(
+ (*hybOutputRealDry >> 1) +
+ (fMultDiv2(*hybOutputRealWet, scaleX) << SF_SCALE),
+ 1, DFRACT_BITS);
+ *hybOutputImagDry = SATURATE_LEFT_SHIFT(
+ (*hybOutputImagDry >> 1) +
+ (fMultDiv2(*hybOutputImagWet, scaleX) << SF_SCALE),
+ 1, DFRACT_BITS);
+ ;
hybOutputRealDry++, hybOutputRealWet++;
hybOutputImagDry++, hybOutputImagWet++;
}