diff --git a/lib_com/options.h b/lib_com/options.h index b21c1cd51eafaf5f23ab90bec9974982c08a524a..7c3a25bdb6a3e1bfcfda8a23f02822015dd2f2b2 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -189,6 +189,7 @@ #define NONBE_FIX_1028_1DB_TCX_LEVEL_DROP /* VA: Harmonize the logic setting LP weighting factor between TCX encoder and TCX decoder */ #define CONF_DISTATT /* Eri: Make distance attenuation configurable */ #define FIX_1052_EXT_OUTPUT /* VA: issue 1052: define EXT decoder output configuration for stereo and MC formats */ +#define NONBE_1215_FIX_JBM_MAX_SCALING /* FhG: issue 1215: Fix assert hit in a specific VoIP decoder config. Caused by integer overflow in max scaling calculation. */ #define NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT /* fix 1070 USAN: nullptr-with-offset and Segfaults in 7_1_4 to BINAURAL and BINAURAL_ROOM_REVERB decoding with bitrate switching and head rotation*/ #define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/ #define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */ diff --git a/lib_dec/jbm_jb4sb.c b/lib_dec/jbm_jb4sb.c index 1c6fdf0fcc713df65338fe309531e8d9e734a2ab..8d45414cb79f30632a60b04cbe1ddee53802484d 100644 --- a/lib_dec/jbm_jb4sb.c +++ b/lib_dec/jbm_jb4sb.c @@ -807,7 +807,15 @@ static void JB4_adaptActivePlayout( ( dropRateMax - dropRateMin ) / dropGapMax + dropRateMin; *scale = ( 1000 - rate ) / 10; +#ifdef NONBE_1215_FIX_JBM_MAX_SCALING + /* Limit max scaling to the duration of one frame. APA will not exceed this limit + * anyway due to the 50% limitation of APA_MIN_SCALE and APA_MAX_SCALE. Limiting + * the value to a sensible range here avoids integer overflows at later stages when + * converting maxScaling from milliseconds to samples. */ + *maxScaling = JB4_MIN( currPlayoutDelay - targetMax, 1000 / IVAS_NUM_FRAMES_PER_SEC ); +#else *maxScaling = currPlayoutDelay - targetMax; +#endif } } } @@ -823,7 +831,15 @@ static void JB4_adaptActivePlayout( currPlayoutDelay < targetMaxStretch && currPlayoutDelay < (uint32_t) ( 110 + h->rfDelay / 4 ) ) { *scale = 120; +#ifdef NONBE_1215_FIX_JBM_MAX_SCALING + /* Limit max scaling to the duration of one frame. APA will not exceed this limit + * anyway due to the 50% limitation of APA_MIN_SCALE and APA_MAX_SCALE. Limiting + * the value to a sensible range here avoids integer overflows at later stages when + * converting maxScaling from milliseconds to samples. */ + *maxScaling = JB4_MIN( targetMaxStretch - currPlayoutDelay, 1000 / IVAS_NUM_FRAMES_PER_SEC ); +#else *maxScaling = targetMaxStretch - currPlayoutDelay; +#endif } }