Commit 943e1a67 authored by multrus's avatar multrus
Browse files

Merge branch...

Merge branch 'basop-2382-clang18-msan-use-of-uninitialized-value-in-lib_dec-ivas_mct_dec_fx-c-225-13' into 'main'

Resolve "[CLANG18] MSAN: use-of-uninitialized-value in lib_dec/ivas_mct_dec_fx.c:225:13"

Closes #2382

See merge request !2770
parents aa34b754 612b9f94
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@
#define FIX_2371_REMOVE_UNUSED_ISAR_FCNS                /* Dolby: basop issue 2371: remove unused ISAR-related functions */      
#define FIX_2384_INIT_DEQUANT_COV                       /* FhG: basop issue 2384: only read initialized values from Cy_buf_e[k] in ivas_param_mc_dequantize_cov_fx() during renormalization */
#define FIX_2383_INIT_Q_A_ITF                           /* FhG: Initialize Q_A_itf, to avoid reading of uninitialized memory in case ITF is not triggered */
#define FIX_2382_COPY_AQ_IN_MCT                         /* FhG: basop issue 2382: 2nd instance of prevent copying uninitialized values from Aq_fx[][] to Aq_fx_32[][] in TCX */

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

+28 −2
Original line number Diff line number Diff line
@@ -214,22 +214,48 @@ ivas_error ivas_mct_dec_fx(
        }
    }

#ifndef FIX_2382_COPY_AQ_IN_MCT
    Word32 Aq_fx_32[6][2][102];
#endif
    /* MCT reconstruction and CoreCoder updates */
    FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ )
    {
#ifdef FIX_2382_COPY_AQ_IN_MCT
        Word32 Aq_fx_32[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )];
#endif
        hCPE = st_ivas->hCPE[cpe_id];

        FOR( n = 0; n < CPE_CHANNELS; n++ )
        {
#ifdef FIX_2382_COPY_AQ_IN_MCT
            IF( NE_16( hCPE->hCoreCoder[n]->mct_chan_mode, MCT_CHAN_MODE_IGNORE ) )
            {
                Word16 nSubframes;

                nSubframes = 1; /* Q0 */
                move16();
                if ( EQ_16( hCPE->hCoreCoder[n]->core, TCX_10_CORE ) )
                {
                    nSubframes = NB_DIV;
                    move16();
                }

                Copy_Scale_sig_16_32_DEPREC( Aq_fx[cpe_id][n], Aq_fx_32[n], i_mult( nSubframes, M ), Q16 - Q12 ); // Q16
            }
#else
            Copy_Scale_sig_16_32_DEPREC( Aq_fx[cpe_id][n], Aq_fx_32[cpe_id][n], 102, Q16 - Q12 ); // Q16
#endif
            x_fx[n][0] = output_fx[n + ( cpe_id * CPE_CHANNELS )];                      // Q11
            x_fx[n][1] = output_fx[n + ( cpe_id * CPE_CHANNELS )] + ( L_FRAME48k / 2 ); // Q11
            move16();
            move16();
        }

#ifdef FIX_2382_COPY_AQ_IN_MCT
        ivas_mdct_core_tns_ns_fx( hCPE, fUseTns[cpe_id], tnsData[cpe_id], x_fx, Aq_fx_32, 1, 20 );
#else
        ivas_mdct_core_tns_ns_fx( hCPE, fUseTns[cpe_id], tnsData[cpe_id], x_fx, Aq_fx_32[cpe_id], 1, 20 );
#endif
    }

    test();
+11 −0
Original line number Diff line number Diff line
@@ -298,8 +298,19 @@ void stereo_mdct_core_dec_fx(

    FOR( ch = 0; ch < nChannels; ch++ )
    {
#ifdef FIX_2382_COPY_AQ_IN_MCT
        nSubframes[ch] = 1; /* Q0 */
        move16();

        if ( EQ_16( sts[ch]->core, TCX_10_CORE ) )
        {
            nSubframes[ch] = NB_DIV;
            move16();
        }
#else
        nSubframes[ch] = EQ_16( sts[ch]->core, TCX_10_CORE ) ? NB_DIV : 1; /* Q0 */
        move16();
#endif

        FOR( k = 0; k < nSubframes[ch]; k++ )
        {