From bc9f98af82b7c6c6c084960d3c596c9f19922b0f Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 20 Jul 2023 11:33:40 +1000 Subject: [PATCH 1/2] fix for UBSAN issue 615 --- lib_com/ivas_spar_com.c | 4 ++++ lib_com/options.h | 1 + lib_enc/ivas_spar_encoder.c | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index ebc9c89466..1836d0cb4d 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -1750,7 +1750,11 @@ void ivas_get_spar_md_from_dirac( { for ( band = start_band; band < end_band; band++ ) { +#ifdef FIX_615_UBSAN_SPAR_TO_DIRAC + ndm = hSpar_md_cfg->num_dmx_chans_per_band[band]; +#else ndm = hSpar_md_cfg->num_dmx_chans_per_band[band - 1]; +#endif /*SPAR from DirAC*/ set_f( response_avg, 0.0f, MAX_OUTPUT_CHANNELS ); diff --git a/lib_com/options.h b/lib_com/options.h index b02e63cd1e..629d6c175c 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -194,6 +194,7 @@ #define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ +#define FIX_615_UBSAN_SPAR_TO_DIRAC /*Dlb : Fix for UBSAN issue 615*/ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 5f382c4719..7fdc8212ea 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -571,8 +571,11 @@ static ivas_error ivas_spar_enc_process( float Wscale_d[IVAS_MAX_NUM_BANDS]; int16_t d_start_band, d_end_band; int16_t dirac_band_idx; - +#ifdef FIX_615_UBSAN_SPAR_TO_DIRAC + d_start_band = SPAR_DIRAC_SPLIT_START_BAND; +#else d_start_band = hSpar->enc_param_start_band; +#endif d_end_band = IVAS_MAX_NUM_BANDS; for ( b = d_start_band; b < d_end_band; b++ ) -- GitLab From 8faab99acffba5a72493f61b5dadf4d2c8623cff Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 20 Jul 2023 12:34:33 +1000 Subject: [PATCH 2/2] fixing dirac start idx back to what it was --- lib_enc/ivas_spar_encoder.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 7fdc8212ea..5f382c4719 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -571,11 +571,8 @@ static ivas_error ivas_spar_enc_process( float Wscale_d[IVAS_MAX_NUM_BANDS]; int16_t d_start_band, d_end_band; int16_t dirac_band_idx; -#ifdef FIX_615_UBSAN_SPAR_TO_DIRAC - d_start_band = SPAR_DIRAC_SPLIT_START_BAND; -#else + d_start_band = hSpar->enc_param_start_band; -#endif d_end_band = IVAS_MAX_NUM_BANDS; for ( b = d_start_band; b < d_end_band; b++ ) -- GitLab