Commit b90711b9 authored by multrus's avatar multrus
Browse files

Merge branch '625-ubsan-index-out-of-bounds-in-ivas_spar_calc_smooth_facs' into 'main'

Resolve "UBSAN: index out of bounds in ivas_spar_calc_smooth_facs"

See merge request !864
parents 30a3f5aa 2ae03116
Loading
Loading
Loading
Loading
Loading

lib_com/options.h

100644 → 100755
+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_625_IDX_OOB                                 /* FhG: Fix index out-of-bounds UBSAN error (issue 625) */

/* ################## End BE DEVELOPMENT switches ######################### */

lib_dec/ivas_spar_decoder.c

100644 → 100755
+8 −0
Original line number Diff line number Diff line
@@ -1019,14 +1019,22 @@ static void ivas_spar_calc_smooth_facs(
    bin = 0;
    for ( b = 0; b < nbands_spar; b++ )
    {
#ifdef FIX_625_IDX_OOB
        if ( bin >= CLDFB_NO_CHANNELS_MAX || ( b > 0 && bin2band->p_cldfb_map_to_spar_band[bin] < bin2band->p_cldfb_map_to_spar_band[bin - 1] ) )
#else
        if ( b > 0 && bin2band->p_cldfb_map_to_spar_band[bin] < bin2band->p_cldfb_map_to_spar_band[bin - 1] )
#endif
        {
            break;
        }

        /* calculate band-wise subframe energies */
        subframe_band_nrg[b] = 0.f;
#ifdef FIX_625_IDX_OOB
        while ( bin < CLDFB_NO_CHANNELS_MAX && b == bin2band->p_cldfb_map_to_spar_band[bin] )
#else
        while ( b == bin2band->p_cldfb_map_to_spar_band[bin] )
#endif
        {
            for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ )
            {