Commit d1bd00a8 authored by multrus's avatar multrus
Browse files

Merge branch '166-valgrind-sba-reading-of-uninitialized-memory-for-384-kbit-s-hoa3' into 'main'

Issue #166 - correctly set MCT variables to avoid reading of wrong memory

See merge request !258
parents 81bba972 3fb390b1
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -153,6 +153,7 @@
#define SBA_BR_SWITCHING                                /* Issue 114: Changes for sba bit rate switching*/
#define FIX_AGC_WINFUNC_MEMORY                          /* Issue 62: lower agc_com.winFunc memory consumption */
#define REMOVE_SID_HARM_LEFTOVERS                       /* Issue 192: remove leftovers from the SID bitrate harmonization */
#define FIX_MCT_UNINIT_MEM                              /* Issue 166: Reading of uninitialized memory in TCX range coder */



+8 −0
Original line number Diff line number Diff line
@@ -881,7 +881,11 @@ void ivas_mdct_core_whitening_enc(
        {
            chE_tot = sum_f( chE, NB_DIV );

#ifdef FIX_MCT_UNINIT_MEM
            if ( chE_tot < SILENT_CHANNEL_THRES && nSubframes == 1 )
#else
            if ( chE_tot < SILENT_CHANNEL_THRES )
#endif
            {
                st->mct_chan_mode = MCT_CHAN_MODE_IGNORE;
                st->bits_frame_channel = 0;
@@ -1055,7 +1059,11 @@ void ivas_mdct_core_whitening_enc(
        {
            st->side_bits_frame_channel = 0;
            /*dummy initialization to prevent range coder crashing in case all channels are silent and bits are distributed to channel 0 */
#ifdef FIX_MCT_UNINIT_MEM
            *p_param[ch] = 1 + NOISE_FILL_RANGES + LTPSIZE + tnsSize[ch][0] + NPRM_CTX_HM;
#else
            *p_param[ch] = 9;
#endif
            continue;
        }