Commit 2b5cfe73 authored by fotopoulou's avatar fotopoulou
Browse files

fix buffer overflows

parent f08d6fa1
Loading
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -77,8 +77,15 @@ void ivas_mct_side_bits(
    {
        for ( ch = 0; ch < CPE_CHANNELS; ch++ )
        {
#ifdef ADJUST_MCT_CHANNELS_MAX
            if ( i < MCT_MAX_CHANNELS )
            {
#endif
                sts[i] = hCPE[cpe_id]->hCoreCoder[ch];
                i++;
#ifdef ADJUST_MCT_CHANNELS_MAX
            }
#endif
        }
    }

@@ -194,11 +201,20 @@ void ivas_mct_core_dec(
    {
        for ( ch = 0; ch < CPE_CHANNELS; ch++ )
        {
#ifdef ADJUST_MCT_CHANNELS_MAX
            if ( i < MCT_MAX_CHANNELS )
            {
#endif
                sts[i] = hCPE[cpe_id]->hCoreCoder[ch];
                i++;
#ifdef ADJUST_MCT_CHANNELS_MAX
            }
#endif
        }
    }

#ifndef ADJUST_MCT_CHANNELS_MAX
    /*seems like obsolete code*/
    for ( ch = 0, i = 0; ch < nChannels; ch++ )
    {
        if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
@@ -207,6 +223,7 @@ void ivas_mct_core_dec(
        }
        i++;
    }
#endif

    bfi = sts[0]->bfi;

+1 −1
Original line number Diff line number Diff line
@@ -250,13 +250,13 @@ void ivas_mct_core_enc(
    {
        for ( ch = 0; ch < CPE_CHANNELS; ch++ )
        {
            sts[i] = hCPE[cpe_id]->hCoreCoder[ch];
            if ( hCPE[cpe_id]->hCoreCoder[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
            {
                i++;
                continue;
            }

            sts[i] = hCPE[cpe_id]->hCoreCoder[ch];
            mdst_spectrum[i][0] = hMCT->p_mdst_spectrum_long[cpe_id][ch];
            mdst_spectrum[i][1] = hMCT->p_mdst_spectrum_long[cpe_id][ch] + N_TCX10_MAX;
            orig_spectrum[i][0] = hMCT->p_orig_spectrum_long[cpe_id][ch];