Commit dde137b5 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge branch...

Merge branch 'basop-2332-clang18-asan-heap-buffer-overflow-in-lib_com-tools_fx-c-5450-25' into 'main'

Resolve "[CLANG18] ASAN: heap-buffer-overflow in lib_com/tools_fx.c:5450:25"

Closes #2332

See merge request !2722
parents 2762e490 32dba599
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -113,6 +113,7 @@
#define FIX_BASOP_2327_WRONG_LOOP_END                   /* Nokia: basop inssue 2327: Correct loop end to solve MSAN error */
#define FIX_BASOP_2328_MSAN_WRONG_ASSIGNMENT            /* Nokia: basop issue 2328: Fix MSAN error by correcting the variable assignment */
#define FIX_BASOP_2329_UNINIT_VALUE                     /* Nokia: basop issue 2329: Fix issue by checking for structure instead of length */
#define FIX_BASOP_2332_ASAN_OVERFLOW_IN_EXT_DIRAC_REND  /* Nokia: basop issue 2332: Uses predefined memory sizes instead computing wrong */

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

+14 −1
Original line number Diff line number Diff line
@@ -11153,12 +11153,17 @@ static void intermidiate_ext_dirac_render(

        IF( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx )
        {
#ifdef FIX_BASOP_2332_ASAN_OVERFLOW_IN_EXT_DIRAC_REND
            Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_len );
#else
            Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, imult1616( hDirACRend->num_outputs_dir, hSpatParamRendCom->num_freq_bands ) );
#endif
            scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_len, shift ); /* Q(hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth + shift) */
            hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth = add( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, shift );
            move16();
        }

#ifndef FIX_BASOP_2332_ASAN_OVERFLOW_IN_EXT_DIRAC_REND
        Word16 num_channels_dir = hDirACRend->num_outputs_dir;
        move16();

@@ -11167,10 +11172,14 @@ static void intermidiate_ext_dirac_render(
            num_channels_dir = hDirACRend->hOutSetup.nchan_out_woLFE;
            move16();
        }

#endif
        IF( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx )
        {
#ifdef FIX_BASOP_2332_ASAN_OVERFLOW_IN_EXT_DIRAC_REND
            tmp = L_norm_arr( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_len );
#else
            tmp = L_norm_arr( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, imult1616( num_channels_dir, hSpatParamRendCom->num_freq_bands ) );
#endif
            scale_sig32( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_len, tmp ); /* Q(h_dirac_output_synthesis_state->q_cy_auto_diff_smooth + tmp) */
            h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = add( h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, tmp );
            move16();
@@ -11192,7 +11201,11 @@ static void intermidiate_ext_dirac_render(
        move16();
        IF( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx )
        {
#ifdef FIX_BASOP_2332_ASAN_OVERFLOW_IN_EXT_DIRAC_REND
            Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_len );
#else
            Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, imult1616( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) );
#endif
            scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_len, shift ); /* Q(hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev + shift) */
            hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev = add( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, shift );
            move16();