diff --git a/lib_com/options.h b/lib_com/options.h index f922513d564692e4b01ee1e012252d320d4051b1..a3d14ba61db1ed98980838ce418ac32ae89eee1f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -96,6 +96,7 @@ #define FIX_2178_FL_TO_FX_WITH_OBJ_EDIT_FILE_INTERFACE /* Nokia: Fixes float to fx conversion in decoder app with object edit file interface */ #define FIX_2070_JBM_TC_CHANNEL_RESCALING_ISSUE /* Eri/Orange: scale_sig32 problem on p_tc_fx[] */ +#define FIX_2173_UBSAN_IN_JBM_PCMDSP_APA /* FhG: Fix UBSAN problems in jbm_pcmdsp_apa_fx.c */ #define FIX_1947_DEC_HIGH_MLD_FOR_STEREO2MONO /* FhG: Make Q-factor of synth_16_fx and output_16_fx dynamic to prevent overflow in HQ_CORE mode */ /* ################### End FIXES switches ########################### */ diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 37e3f51a755bfa0c4faf5aaded471bfd3c6824b5..bc9ef573f8339baec7b10a82e745e8852cc3d8a8 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -127,7 +127,11 @@ struct apa_state_t UWord16 qualityred; /* quality reduction threshold */ UWord16 qualityrise; /* quality rising for adaptive quality thresholds */ - UWord16 last_pitch; /* last pitch/sync position */ +#ifdef FIX_2173_UBSAN_IN_JBM_PCMDSP_APA + Word16 last_pitch; /* last pitch/sync position */ +#else + UWord16 last_pitch; /* last pitch/sync position */ +#endif UWord16 bad_frame_count; /* # frames before quality threshold is lowered */ UWord16 good_frame_count; /* # scaled frames */ @@ -1392,7 +1396,11 @@ static Word8 logarithmic_search_fx( const apa_state_t *ps, DO { +#ifdef FIX_2173_UBSAN_IN_JBM_PCMDSP_APA + coeff_max = INT32_MIN; /* will always be overwritten with result of first correlation */ +#else coeff_max = 0x80000000; /* will always be overwritten with result of first correlation */ +#endif move32(); FOR( i = s_start; i < s_start + inlen; i += css * ps->num_channels )