Commit cf4064b3 authored by vaclav's avatar vaclav
Browse files

Merge branch 'basop-2264-out-of-bound-reading-in-log2_norm_lc' into 'main'

Basop 2264 out of bound reading in log2 norm lc [non-BE]

See merge request !2636
parents d2ae3897 7c1c6cef
Loading
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -57,10 +57,15 @@ 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

    if ( L_x > 0 )                   /* There are many cases in the code where L_x == 0 */
        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 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@
#define NONBE_FIX_1967_SBA_DECODER_MONO_OUT_BIG_DIFFERENCES /* Dolby: Fix basop issue 1967 */
#define FIX_1461_CNG_BW_SWITCHING                       /* Eri: float issue 1461: Stereo parameters are not updated when SID/NODATA forces BW to stay the same */
#define FIX_2041_SPECTRAL_GAPS_FOR_INACTIVE_FRAMES      /* FhG: Using rounding in multiplication to improve precision in cngNoiseLevel[] */
#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 ########################### */

+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 ) );