aboutsummaryrefslogtreecommitdiffstats
path: root/libAACdec/src/usacdec_acelp.cpp
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2018-05-24 07:24:02 -0700
committerandroid-build-merger <android-build-merger@google.com>2018-05-24 07:24:02 -0700
commit634d4f789cc713fd374db7b9dbcaeb1d89bf2d5e (patch)
tree4f088dbfd47d22d3f90ebcbcf054a26d6e69bdce /libAACdec/src/usacdec_acelp.cpp
parent57d474b424be58783e7abba469d2f3d800094967 (diff)
parenta4d1f0ad52e2cf6f168d2193216602f52033fc27 (diff)
downloadfdk-aac-634d4f789cc713fd374db7b9dbcaeb1d89bf2d5e.tar.gz
fdk-aac-634d4f789cc713fd374db7b9dbcaeb1d89bf2d5e.tar.bz2
fdk-aac-634d4f789cc713fd374db7b9dbcaeb1d89bf2d5e.zip
FDKv2 ubsan patches
am: a4d1f0ad52 Change-Id: Ic489768836aae6a9b9cab9e866ecc8b21d819368
Diffstat (limited to 'libAACdec/src/usacdec_acelp.cpp')
-rw-r--r--libAACdec/src/usacdec_acelp.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/libAACdec/src/usacdec_acelp.cpp b/libAACdec/src/usacdec_acelp.cpp
index ec4437f..af1f488 100644
--- a/libAACdec/src/usacdec_acelp.cpp
+++ b/libAACdec/src/usacdec_acelp.cpp
@@ -1116,7 +1116,8 @@ void CLpd_AcelpPrepareInternalMem(const FIXP_DBL *synth, UCHAR last_lpd_mode,
const FIXP_LPC *A_new, const INT A_new_exp,
const FIXP_LPC *A_old, const INT A_old_exp,
CAcelpStaticMem *acelp_mem,
- INT coreCoderFrameLength, UCHAR lpd_mode) {
+ INT coreCoderFrameLength, INT clearOldExc,
+ UCHAR lpd_mode) {
int l_div =
coreCoderFrameLength / NB_DIV; /* length of one ACELP/TCX20 frame */
int l_div_partial;
@@ -1154,6 +1155,13 @@ void CLpd_AcelpPrepareInternalMem(const FIXP_DBL *synth, UCHAR last_lpd_mode,
&syn[PIT_MAX_MAX + L_INTERPOL - M_LP_FILTER_ORDER],
M_LP_FILTER_ORDER * sizeof(FIXP_DBL));
+ if (clearOldExc) {
+ FDKmemclear(old_exc_mem, (PIT_MAX_MAX + L_INTERPOL) * sizeof(FIXP_DBL));
+ C_ALLOC_SCRATCH_END(synth_buf, FIXP_DBL,
+ PIT_MAX_MAX + L_INTERPOL + M_LP_FILTER_ORDER);
+ return;
+ }
+
/* update past [PIT_MAX_MAX+L_INTERPOL] samples of exc memory */
if (last_lpd_mode == 1) { /* last frame was TCX20 */
if (last_last_lpd_mode == 0) { /* ACELP -> TCX20 -> ACELP transition */
@@ -1170,7 +1178,6 @@ void CLpd_AcelpPrepareInternalMem(const FIXP_DBL *synth, UCHAR last_lpd_mode,
int exc_A_new_length = (coreCoderFrameLength / 2 > PIT_MAX_MAX + L_INTERPOL)
? PIT_MAX_MAX + L_INTERPOL
: coreCoderFrameLength / 2;
-
int exc_A_old_length = PIT_MAX_MAX + L_INTERPOL - exc_A_new_length;
E_UTIL_residu(A_old, A_old_exp, syn, old_exc_mem, exc_A_old_length);
E_UTIL_residu(A_new, A_new_exp, &syn[exc_A_old_length],