aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2018-10-12 04:41:31 -0700
committerandroid-build-merger <android-build-merger@google.com>2018-10-12 04:41:31 -0700
commit0ff211e4fb39226294e996e58b75bbc8681b416f (patch)
tree46e1a76e378c9f2bd444d36bc4c8e5255f59a38d
parent14ea3dc906e50e356a50b010497ba87b40cb2a82 (diff)
parent1c4c4a8c97a92ad43b221e9a4525e418e2662404 (diff)
downloadfdk-aac-0ff211e4fb39226294e996e58b75bbc8681b416f.tar.gz
fdk-aac-0ff211e4fb39226294e996e58b75bbc8681b416f.tar.bz2
fdk-aac-0ff211e4fb39226294e996e58b75bbc8681b416f.zip
Merge "Prevent out of bounds accesses in lppTransposer()" into oc-dev am: 5a025c4fea
am: 1c4c4a8c97 Change-Id: I547a825e0a48ef9f3c48b29ea2443f9945da52a2
-rw-r--r--Android.bp3
-rw-r--r--libSBRdec/src/lpp_tran.cpp37
2 files changed, 27 insertions, 13 deletions
diff --git a/Android.bp b/Android.bp
index daad82c..7966dc6 100644
--- a/Android.bp
+++ b/Android.bp
@@ -19,6 +19,9 @@ cc_library_static {
"-Wno-constant-logical-operand",
"-Wno-self-assign",
],
+ shared_libs: [
+ "liblog",
+ ],
export_include_dirs: [
"libAACdec/include",
"libAACenc/include",
diff --git a/libSBRdec/src/lpp_tran.cpp b/libSBRdec/src/lpp_tran.cpp
index 343aec3..ae282d5 100644
--- a/libSBRdec/src/lpp_tran.cpp
+++ b/libSBRdec/src/lpp_tran.cpp
@@ -96,6 +96,10 @@ amm-info@iis.fraunhofer.de
\sa lppTransposer(), main_audio.cpp, sbr_scale.h, \ref documentationOverview
*/
+#ifdef __ANDROID__
+#include "log/log.h"
+#endif
+
#include "lpp_tran.h"
#include "sbr_ram.h"
@@ -256,7 +260,6 @@ void lppTransposer (HANDLE_SBR_LPP_TRANS hLppTrans, /*!< Handle of lpp transp
int ovLowBandShift;
int lowBandShift;
/* int ovHighBandShift;*/
- int targetStopBand;
alphai[0] = FL2FXCONST_SGL(0.0f);
@@ -273,24 +276,32 @@ void lppTransposer (HANDLE_SBR_LPP_TRANS hLppTrans, /*!< Handle of lpp transp
autoCorrLength = pSettings->nCols + pSettings->overlap;
- /* Set upper subbands to zero:
- This is required in case that the patches do not cover the complete highband
- (because the last patch would be too short).
- Possible optimization: Clearing bands up to usb would be sufficient here. */
- targetStopBand = patchParam[pSettings->noOfPatches-1].targetStartBand
- + patchParam[pSettings->noOfPatches-1].numBandsInPatch;
+ if (pSettings->noOfPatches > 0) {
+ /* Set upper subbands to zero:
+ This is required in case that the patches do not cover the complete highband
+ (because the last patch would be too short).
+ Possible optimization: Clearing bands up to usb would be sufficient here. */
+ int targetStopBand = patchParam[pSettings->noOfPatches-1].targetStartBand
+ + patchParam[pSettings->noOfPatches-1].numBandsInPatch;
- int memSize = ((64) - targetStopBand) * sizeof(FIXP_DBL);
+ int memSize = ((64) - targetStopBand) * sizeof(FIXP_DBL);
- if (!useLP) {
+ if (!useLP) {
+ for (i = startSample; i < stopSampleClear; i++) {
+ FDKmemclear(&qmfBufferReal[i][targetStopBand], memSize);
+ FDKmemclear(&qmfBufferImag[i][targetStopBand], memSize);
+ }
+ } else
for (i = startSample; i < stopSampleClear; i++) {
FDKmemclear(&qmfBufferReal[i][targetStopBand], memSize);
- FDKmemclear(&qmfBufferImag[i][targetStopBand], memSize);
}
- } else
- for (i = startSample; i < stopSampleClear; i++) {
- FDKmemclear(&qmfBufferReal[i][targetStopBand], memSize);
}
+#ifdef __ANDROID__
+ else {
+ // Safetynet logging
+ android_errorWriteLog(0x534e4554, "112160868");
+ }
+#endif
/* init bwIndex for each patch */
FDKmemclear(bwIndex, MAX_NUM_PATCHES*sizeof(INT));