Commit ed872af4 authored by multrus's avatar multrus
Browse files

Merge branch...

Merge branch 'basop-2356-clang18-msan-use-of-uninitialized-value-in-lib_enc-ivas_mct_enc_mct_fx-c-99-27' into 'main'

Resolve "[CLANG18] MSAN: use-of-uninitialized-value in lib_enc/ivas_mct_enc_mct_fx.c:99:27"

Closes #2356

See merge request !2755
parents 0b7e60d2 86697811
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@
#define REMOVE_SCALING_SHB_SPEECH                       /* VA: remove unnecessary scaling and 32-bit buffers from ivas_core_enc_fx() */
#define FIX_2352_COPY_AQ_IN_TCX                         /* FhG: basop issue 2352: prevent copying uninitialized values from Aq_fx[][] to Aq_fx_32[][] in TCX */
#define FIX_2353_PTR_INIT                               /* FhG: basop issue 2353: initialize prm_sqQ-pointer, to prevent being uninitialized in case of bfi == 1 */
#define FIX_2356_GET_CHAN_ENERGIES                      /* FhG: basop issue 2356: correctly initialize exponents in getChannelEnergies_fx() */

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

+14 −0
Original line number Diff line number Diff line
@@ -88,19 +88,33 @@ void getChannelEnergies_fx(

            gb = find_guarded_bits_fx( (Word32) L_subframe );

#ifndef FIX_2356_GET_CHAN_ENERGIES
            sum2_e = st->hTcxEnc->spectrum_e[0];
            move16();
#endif
            nrg[ch] = 0;
            move32();
#ifdef FIX_2356_GET_CHAN_ENERGIES
            nrg_e[ch] = 0; /* if the mantissa is 0, the exponent gets set to sum2_e inside BASOP_Util_Add_Mant32Exp() */
            move16();
#endif

            FOR( n = 0; n < nSubframes; n++ )
            {
#ifdef FIX_2356_GET_CHAN_ENERGIES
                sum2_e = st->hTcxEnc->spectrum_e[n];
                move16();

#endif
                sum2 = sum2_32_exp_fx( st->hTcxEnc->spectrum_fx[n], L_subframe, &sum2_e, gb ); // 31 - sum2_e

                nrg[ch] = BASOP_Util_Add_Mant32Exp( nrg[ch], nrg_e[ch], sum2, sum2_e, &nrg_e[ch] );
                move32();

#ifndef FIX_2356_GET_CHAN_ENERGIES
                sum2_e = st->hTcxEnc->spectrum_e[0];
                move16();
#endif
            }

            nrg[ch] = Sqrt32( nrg[ch], &nrg_e[ch] ); // nrg_e