From 796768331a409415b599426ee2aebd1f5f0e0a04 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 12 Dec 2025 16:41:38 +0100 Subject: [PATCH] fix USAN OOB index complaint --- lib_com/options.h | 1 + lib_enc/enc_acelp.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 59daf40a86..62ee995b19 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -162,6 +162,7 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ +#define FIX_2274_OOB_INDEXING_IN_CORRMATRIX /* FhG: fix OOB indexing complaint */ /* #################### End BE switches ################################## */ diff --git a/lib_enc/enc_acelp.c b/lib_enc/enc_acelp.c index 9d085392f5..75287a4d18 100644 --- a/lib_enc/enc_acelp.c +++ b/lib_enc/enc_acelp.c @@ -492,7 +492,14 @@ static void E_ACELP_corrmatrix( p3 = &rrixiy[2][pos]; p2 = &rrixiy[1][pos]; p1 = &rrixiy[0][pos]; +#ifdef FIX_2274_OOB_INDEXING_IN_CORRMATRIX + p0 = &rrixiy[3][pos]; + /* decrement pointer instead of indexing the array to avoid CLANG Usan complaint */ + /* for last loop iteration, this points to rrixiy[3][-1], but is not actually accessed in later loop (k = 15 then, so inner loop will not run) */ + p0 -= 16; +#else p0 = &rrixiy[3][pos - 16]; +#endif cor = 0.0F; ptr_h1 = h; -- GitLab