1
0
mirror of https://github.com/mstorsjo/fdk-aac.git synced 2025-02-10 08:30:37 +01:00

Merge "Prevent out of bounds accesses in lppTransposer()" into oc-dev

This commit is contained in:
TreeHugger Robot 2018-10-12 11:26:30 +00:00 committed by Android (Google) Code Review
commit 5a025c4fea
2 changed files with 27 additions and 13 deletions

View File

@ -18,6 +18,9 @@ cc_library_static {
"-Wno-constant-logical-operand",
"-Wno-self-assign",
],
shared_libs: [
"liblog",
],
export_include_dirs: [
"libAACdec/include",
"libAACenc/include",

View File

@ -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));