From 81f759d6d759600a057e9a7d0c63ce116d87ca7d Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Thu, 18 Dec 2025 14:27:52 +0100 Subject: [PATCH 1/2] Add FIX_1480_CLANG18_MSAN_UNINIT_VARIABLE to resolve clang-18 MSAN error --- lib_com/options.h | 1 + lib_dec/hq_hr_dec.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index fc3d5173a8..dc93a54f45 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,6 +172,7 @@ #define FIX_2287_MCT_MDCT_STEREO_DATA_MALLOC_SIZE /* FhG: correct allocation size for STEREO_MDCT_DEC_DATA struct */ #define FIX_2271_OOB_INDEXING_IN_PIT_OL2 /* VA: Fix for issue 2271, to silence clang18 */ #define FIX_2273_OOB_INDEXING_IN_PIT_FR4 /* VA: Fix to silence clang on ptr init */ +#define FIX_1480_CLANG18_MSAN_UNINIT_VARIABLE /* Eri: Initializes two variables in HQ decoder. They are not used, but they are passed uninitialized to a function which is caught by clang-18 */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/hq_hr_dec.c b/lib_dec/hq_hr_dec.c index 165d52f6b0..47c5e2b8d7 100644 --- a/lib_dec/hq_hr_dec.c +++ b/lib_dec/hq_hr_dec.c @@ -137,6 +137,10 @@ void hq_hr_dec( HQ_DEC_HANDLE hHQ_core = st->hHQ_core; bits_left = num_bits; +#ifdef FIX_1480_CLANG18_MSAN_UNINIT_VARIABLE + SWB_fenv = NULL; /* Init in case HQ_GEN_SWB/HQ_GEN_FB is not used -- eliminates runtime warning when passed to fill_spectrum */ + hq_generic_offset = 0; +#endif /*------------------------------------------------------------------* * Initializations -- GitLab From ee79c50a8c78b8dbaf19b5f8119672efcd70c66f Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Thu, 18 Dec 2025 16:01:22 +0100 Subject: [PATCH 2/2] Fix wrong init of SWB_fenv --- lib_dec/hq_hr_dec.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_dec/hq_hr_dec.c b/lib_dec/hq_hr_dec.c index 47c5e2b8d7..9055a9e2e3 100644 --- a/lib_dec/hq_hr_dec.c +++ b/lib_dec/hq_hr_dec.c @@ -138,7 +138,6 @@ void hq_hr_dec( HQ_DEC_HANDLE hHQ_core = st->hHQ_core; bits_left = num_bits; #ifdef FIX_1480_CLANG18_MSAN_UNINIT_VARIABLE - SWB_fenv = NULL; /* Init in case HQ_GEN_SWB/HQ_GEN_FB is not used -- eliminates runtime warning when passed to fill_spectrum */ hq_generic_offset = 0; #endif -- GitLab