From 9e911547a3dedd702593a2bbe7c808fd24a0744e Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 25 Feb 2026 10:50:04 +0100 Subject: [PATCH 1/2] init variable to fix msan complaint --- lib_com/options.h | 1 + lib_dec/hf_synth.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 33c1d943ab..402c5b287f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -164,6 +164,7 @@ #define FIX_2235_TD_RENDERER_WORD16 /* Eri: For float: small synch with BASOP, removing unnecessary abs. BASOP: Use Word16 in TD renderer without converting to Word32 */ #define FIX_FLOAT_1526_DIRAC_MEM_LEAK /* FhG: potential memory leak in DirAC handles in case of format switching */ #define ALIGN_ACELP_CORE /* VA: align ACELP core functions with BASOP */ +#define FIX_1532_MSAN_ERR_AMR_FIRST_FRAME_IS_SID /* FhG: fix msan complaint in AMR-WB when first frame is an SID */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/hf_synth.c b/lib_dec/hf_synth.c index fe2bd60c0f..b18d4367f9 100644 --- a/lib_dec/hf_synth.c +++ b/lib_dec/hf_synth.c @@ -434,6 +434,13 @@ void hf_synth_amr_wb( } } +#ifdef FIX_1532_MSAN_ERR_AMR_FIRST_FRAME_IS_SID + /* Initialize to fix clang-18 sanitizer complaint */ + for ( i = 0; i < NB_SUBFR; ++i ) + { + HF_corr_gain[i] = 1.0f; + } +#endif if ( core_brate == ACELP_23k85 ) { for ( i = 0; i < NB_SUBFR; i++ ) -- GitLab From 274f7207e8c01721b0ce42bc23af7874bfebf4e0 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 25 Feb 2026 11:02:08 +0100 Subject: [PATCH 2/2] move init into else --- lib_dec/hf_synth.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib_dec/hf_synth.c b/lib_dec/hf_synth.c index b18d4367f9..9b4276ad95 100644 --- a/lib_dec/hf_synth.c +++ b/lib_dec/hf_synth.c @@ -434,13 +434,6 @@ void hf_synth_amr_wb( } } -#ifdef FIX_1532_MSAN_ERR_AMR_FIRST_FRAME_IS_SID - /* Initialize to fix clang-18 sanitizer complaint */ - for ( i = 0; i < NB_SUBFR; ++i ) - { - HF_corr_gain[i] = 1.0f; - } -#endif if ( core_brate == ACELP_23k85 ) { for ( i = 0; i < NB_SUBFR; i++ ) @@ -448,6 +441,16 @@ void hf_synth_amr_wb( HF_corr_gain[i] = 2 * HP_gain[hf_gain[i]]; } } +#ifdef FIX_1532_MSAN_ERR_AMR_FIRST_FRAME_IS_SID + else + { + /* Initialize to fix clang-18 sanitizer complaint */ + for ( i = 0; i < NB_SUBFR; ++i ) + { + HF_corr_gain[i] = 1.0f; + } + } +#endif /* inverse DCT transform of HF excitation */ set_f( exc16k, 0.0f, L_FRAME16k ); -- GitLab