diff --git a/lib_com/mslvq_com_fx.c b/lib_com/mslvq_com_fx.c index d2db655f13038748b26cf2f06a1a651b023665af..748f2f564111b7117de420a63d5d82e179bf0d02 100644 --- a/lib_com/mslvq_com_fx.c +++ b/lib_com/mslvq_com_fx.c @@ -904,8 +904,17 @@ static void decode_comb_fx( ) { Word16 idx_sign; - - idx_sign = extract_l( div_l( L_shl( index, 1 ), pi0[idx_lead] ) ); /*(index/pi0_fx[idx_lead]); */ +#ifdef FIX_961_CRASH_DIV_L + IF( LT_32( L_shl( index, 1 ), pi0[idx_lead] ) ) + { + idx_sign = 0; + move16(); + } + ELSE +#endif + { + idx_sign = extract_l( div_l( L_shl( index, 1 ), pi0[idx_lead] ) ); /*(index/pi0_fx[idx_lead]); */ + } index = L_sub( index, L_mult0( idx_sign, pi0[idx_lead] ) ); decode_leaders_fx( extract_l( index ), idx_lead, cv ); decode_sign_pc1_fx( cv, idx_sign, pl_par[idx_lead] ); diff --git a/lib_com/options.h b/lib_com/options.h index d19e9d6b867b416fc42b0ea709ada712c2768bcf..06b5bb4131e8975045ffe3df866b61facf02f632 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -173,7 +173,7 @@ #define FIX_835_PARAMMC_BUFFER_VALUES /* FhG: issue 835: wide range of buffer values for cx in ParamMC */ #define FIX_860_FER_CRASH /* VA: fix crash issues caused by saturation within shl */ - +#define FIX_961_CRASH_DIV_L /* VA: fix to potential crash in div_l when index is <= 0 */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */