From 0481f7fb36942e247d68b7f2aba9d47238aa85ef Mon Sep 17 00:00:00 2001 From: knj Date: Tue, 18 Jul 2023 15:31:43 +0200 Subject: [PATCH] fix ubsan error in sns_avq_dec --- lib_com/options.h | 1 + lib_dec/ivas_sns_dec.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 57154a5247..43b9197066 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,6 +174,7 @@ #define FIX_MEM_REALLOC_IND_LIST /* VA: issue 601: failure of the automatic memory re-allocation mechanism when ind_list[] buffer is depleted in MASA mode with 2 TC*/ #define FIX_581_CLANG_OFFSET_TO_NULL /* FhG: issue 581: fix CLANG error about applying an offset to a NULL pointer */ #define JBM_PARAMUPMIX /* Dlb: Issue 471: Integrate the Multichannel Parametric Upmix into the JBM path */ +#define FIX_582_INDEX_OUT_OF_BOUNDS_SNS_AVQ_DEC /* FhG: fix an undefined behaviour error in SNS AVQ decoding */ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_sns_dec.c b/lib_dec/ivas_sns_dec.c index e11551d2a6..adcfe88186 100644 --- a/lib_dec/ivas_sns_dec.c +++ b/lib_dec/ivas_sns_dec.c @@ -161,7 +161,11 @@ void sns_avq_dec( { for ( i = 0; i < M; i++ ) { +#ifdef FIX_582_INDEX_OUT_OF_BOUNDS_SNS_AVQ_DEC + SNS_Q[0][i] = SNS_Q[1][i]; +#else SNS_Q[0][i] = SNS_Q[0][M + i]; +#endif } sns_2st_dec( SNS_Q[0], index ); } -- GitLab