From 6d95be087e7e0b14312d0a49c2294ffb28405fa8 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 4 Jul 2025 15:16:54 +0530 Subject: [PATCH] Fix for 3GPP issue 1798: Decoder crash for ParamUpmix MC 7.1+4 at 160kbps decoding to mono at 16/32kHz in ivas_ls_setup_conversion_process_mdct_fx() Link #1798 --- lib_dec/ivas_out_setup_conversion_fx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib_dec/ivas_out_setup_conversion_fx.c b/lib_dec/ivas_out_setup_conversion_fx.c index 2135cd6d6..6e78e9c69 100644 --- a/lib_dec/ivas_out_setup_conversion_fx.c +++ b/lib_dec/ivas_out_setup_conversion_fx.c @@ -695,6 +695,11 @@ void ivas_ls_setup_conversion_process_mdct_fx( Word16 guard_1 = shr( add( find_guarded_bits_fx( tmp_sub ), 1 ), 1 ); Word16 guard_2 = find_guarded_bits_fx( L_mult0( outChannels, inChannels ) ); q_output = sub( q_output, s_max( guard_1, guard_2 ) ); + /* Increase the guard bit by 1 to avoid overflow only if q_output is positive */ + if ( q_output > 0 ) + { + q_output = sub( q_output, 1 ); + } FOR( i = 0; i < inChannels; ++i ) { -- GitLab