Unverified Commit 086f9eee authored by norvell's avatar norvell
Browse files

Add USAN fix under FIX_1474_USAN_TRANS_INV

parent f8bb73a7
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@
#define FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH /* FhG: fix oob indexing USAN complaint */
#define FIX_2287_MCT_MDCT_STEREO_DATA_MALLOC_SIZE       /* FhG: correct allocation size for STEREO_MDCT_DEC_DATA struct */
#define FIX_1904_HARM_GSC_ENC                           /* VA: #1904 Harmonization of EVS and IVAS GSC code */
#define FIX_1474_USAN_TRANS_INV                         /* Eri: Float issue 1474: Fix USAN out-of-bounds warning. No OOB occurs, but the pointer is set to point to uninitialized memory. */

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

+18 −3
Original line number Diff line number Diff line
@@ -76,14 +76,21 @@ void direct_transform_fx(
            move32();
        }

#ifndef FIX_1474_USAN_TRANS_INV
        iseg_fx = &in32_r16_fx[-segment_length4]; /*Q*/
#endif
        oseg_fx = out32_fx; /*Q*/

        wh_fx = &win_fx[segment_length4]; /*Q15*/
        wl_fx = wh_fx - 1;                /*Q15*/

#ifdef FIX_1474_USAN_TRANS_INV
        shift = extract_l( L_mult0( 2, segment_length4 ) ); /*Q0*/
        sh_fx = &in32_r16_fx[shift];                        /*Q*/
#else
        shift = extract_l( L_mult0( 3, segment_length4 ) ); /*Q0*/
        sh_fx = &iseg_fx[shift];                            /*Q*/
#endif
        sl_fx2 = sh_fx - 1; /*Q*/


@@ -94,7 +101,11 @@ void direct_transform_fx(
            move32();
        }

#ifdef FIX_1474_USAN_TRANS_INV
        sl_fx2 = &in32_r16_fx[( segment_length4 - 1 )]; /*Q*/
#else
        sl_fx2 = &iseg_fx[( segment_length2 - 1 )];         /*Q*/
#endif

        FOR( i = segment_length4; i < segment_length2; i++ )
        {
@@ -107,7 +118,11 @@ void direct_transform_fx(
        edct_fx( dctin32_fx, oseg_fx, segment_length2, &Qs[0] );
        Qmin = s_min( Qs[0], Qmin );

#ifdef FIX_1474_USAN_TRANS_INV
        iseg_fx = &in32_r16_fx[segment_length4];
#else
        iseg_fx += segment_length2;
#endif
        oseg_fx += segment_length2;

        FOR( seg = 1; seg < NUM_TIME_SWITCHING_BLOCKS - 1; seg++ )
+19 −3
Original line number Diff line number Diff line
@@ -1032,7 +1032,11 @@ void Inverse_Transform(
            }
        }

#ifdef FIX_1474_USAN_TRANS_INV
        out_segment = out_alias;
#else
        out_segment = out_alias - segment_length_div4;
#endif
        in_segment = in_mdct_modif; /*Q*/

        tmp = *Q;
@@ -1051,7 +1055,11 @@ void Inverse_Transform(

        FOR( ta = segment_length_div4; ta < segment_length_div2; ta++ )
        {
#ifdef FIX_1474_USAN_TRANS_INV
            *out_segment++ = L_shr( alias[ta], tmp ); /*q_out*/
#else
            out_segment[ta] = L_shr( alias[ta], tmp );                        /*q_out*/
#endif
            move32();
        }
        /* This previous loop fills the output buffer from [0..seg_len_div4-1] */
@@ -1059,12 +1067,20 @@ void Inverse_Transform(
        win2 = &win[segment_length_div2]; /*Q15*/
        FOR( ta = segment_length_div2; ta < segment_length; ta++ )
        {
#ifdef FIX_1474_USAN_TRANS_INV
            *out_segment++ = L_shr( Mult_32_16( alias[ta], *--win2 ), tmp ); /*q_out*/
#else
            out_segment[ta] = L_shr( Mult_32_16( alias[ta], *--win2 ), tmp ); /*q_out*/
#endif
            move32();
        }
        /* This previous loop fills the output buffer from [seg_len_div4..seg_len-seg_len_div4-1] */

#ifdef FIX_1474_USAN_TRANS_INV
        out_segment = &out_alias[segment_length_div4]; /*q_out*/
#else
        out_segment += segment_length_div2;                                   /*q_out*/
#endif
        in_segment += segment_length_div2; /*Q*/

        FOR( seg = 1; seg < NUM_TIME_SWITCHING_BLOCKS - 1; seg++ )