diff --git a/lib_com/options.h b/lib_com/options.h index e4f546e9ab2e6e58e73624f04797d7a6acb2171d..1a8b3343fb2d0ee59ded96e6c8ab71442919e5b7 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -206,6 +206,7 @@ #define FIX617_UBSAN_DIVBYZERO_STEREOCNG /* Eri: Issue 617: Decoder UBSAN: division by zero in stereo cng when inut is 16kHz and output is 32kHz */ #define FIX_279_CODE_COVERAGE /* Dlb : issue 279 , clean up unused function */ #define FIX_549_PARAM_ISM_BIN_GAIN /* FhG: Issue 549 : fix too quiet binaural output in ParamISM */ +#define FIX_618_STEREO_SW_DIV_BY_ZERO /* VA: fix issue 618 - UBSAN: division-by-zero in stereo bitrate switching */ #define FIX_625_IDX_OOB /* FhG: Fix index out-of-bounds UBSAN error (issue 625) */ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_enc/swb_tbe_enc.c b/lib_enc/swb_tbe_enc.c index 38a0fb73ff28753dcc9b97b21e722cc1cfe3f00f..972a0b177d12547cd86f743cdd9ab3897eebd8bc 100644 --- a/lib_enc/swb_tbe_enc.c +++ b/lib_enc/swb_tbe_enc.c @@ -1259,7 +1259,11 @@ void swb_tbe_enc( GainFrame *= temp; } +#ifdef FIX_618_STEREO_SW_DIV_BY_ZERO + if ( st->element_mode > EVS_MONO && st->L_frame != st->last_L_frame && hBWE_TD->prev_gainFr_SHB != 0 && ( st->last_extl == SWB_TBE || st->last_extl == FB_TBE ) && st->coder_type == TRANSITION && st->coder_type_raw != VOICED && st->clas == VOICED_CLAS && st->last_clas == VOICED_CLAS && ( 3.0f * voice_factors[0] < voice_factors[( st->L_frame >> 6 ) - 1] ) ) +#else if ( st->element_mode > EVS_MONO && st->L_frame != st->last_L_frame && st->coder_type == TRANSITION && st->coder_type_raw != VOICED && st->clas == VOICED_CLAS && st->last_clas == VOICED_CLAS && ( 3.0f * voice_factors[0] < voice_factors[( st->L_frame >> 6 ) - 1] ) ) +#endif { float fac = GainFrame / hBWE_TD->prev_gainFr_SHB; diff --git a/scripts/ubsan.supp b/scripts/ubsan.supp index 64f98bb3a6618ae286bf68a4c7e8820a00576930..0e32af3ae1b21efb3b8e98b0cc176874847122fc 100644 --- a/scripts/ubsan.supp +++ b/scripts/ubsan.supp @@ -6,7 +6,6 @@ bounds:enc_gain.c bounds:ivas_spar_decoder.c bounds:trans_direct.c bounds:trans_inv.c -float-divide-by-zero:swb_tbe_enc.c implicit-integer-sign-change:ACcontextMapping.c implicit-integer-sign-change:avq_dec.c implicit-integer-sign-change:bitstream.c