Commit 3f92402c authored by vaillancour's avatar vaillancour
Browse files

Fix proposal for 2264, out-of-bound access in log2

parent 24e8bdab
Loading
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -57,10 +57,13 @@ Word16 Log2_norm_lc( /* (o) : Fractional part of Log2. (range: 0<=val
{
    Word16 i, a;
    Word16 y;

#ifndef FIX_2264_OUT_OF_BOUND_READING_IN_LOG2_NORM_LC
    if ( L_x <= 0 )
        L_x = L_deposit_h( 0x4000 );

#else
    assert( L_x >= 0x40000000 ); /* If assert fail, means input is not normalized as it should be */
    L_x = L_max( L_x, 0x40000000 );
#endif
    L_x = L_shr( L_x, 9 );
    a = extract_l( L_x ); /* Extract b10-b24 of fraction */
    a = lshr( a, 1 );
+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@
#define FIX_2015_PREMPH_SAT_ALT_PART2                   /* VA: Add missing scaling factor to be passed to AVQ_cod() */
#define FIX_2253_CORRECT_GSC_MINIMUM_PIT_SEARCH         /* VA: Fix Issue 2253 where the encoder and decoder could get out of sync */
#define NONBE_FIX_1967_SBA_DECODER_MONO_OUT_BIG_DIFFERENCES /* Dolby: Fix basop issue 1967 */

#define FIX_2264_OUT_OF_BOUND_READING_IN_LOG2_NORM_LC   /* VA: Fix issue 2264 by adding a proper safeguard in log2 and by adding a missing normalization in swb_pre_proc_ivas_fx()*/
/* ##################### End NON-BE switches ########################### */

/* ################## End MAINTENANCE switches ######################### */
+3 −0
Original line number Diff line number Diff line
@@ -1125,6 +1125,9 @@ void swb_pre_proc_ivas_fx(
                CldfbHB_fx = EPSILON_FX;
                move32();
            }
#ifdef FIX_2264_OUT_OF_BOUND_READING_IN_LOG2_NORM_LC 
            exp = norm_l( CldfbHB_fx );
#endif
            CldfbHB_fx = L_shl( CldfbHB_fx, exp );   /* CldfbHB_ener = CldfbHB_fl*2^(exp) */
            Cldfbtemp1 = Log2_norm_lc( CldfbHB_fx ); /* Log2_norm_lc(t) = 2^15*(log2(t/2^30)) */
            Cldfbtemp1 = sub( shr( Cldfbtemp1, 6 ), shl( add( sub( Q31 - Q30, CldfbHB_fx_e ), exp ), 9 ) );