Commit f0a9d015 authored by multrus's avatar multrus
Browse files

Merge branch '618-ubsan-division-by-zero-in-stereo-bitrate-switching' into 'main'

[non-BE] Resolve "UBSAN: division-by-zero in stereo bitrate switching"

See merge request !863
parents b90711b9 6cde32ae
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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 ######################### */
+4 −0
Original line number Diff line number Diff line
@@ -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;

+0 −1
Original line number Diff line number Diff line
@@ -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