From 6c4e581f0537b22f07d8857cb50808450775a079 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 27 Jun 2025 10:55:19 +0530 Subject: [PATCH] Fix for ASAN error in decoder --- lib_dec/ivas_jbm_dec_fx.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index e1ac2c1ff..008093a89 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -1037,7 +1037,18 @@ ivas_error ivas_jbm_dec_tc_fx( move16(); nchan_out = nchan_transport; move16(); - Word16 Q_p_output = s_max( 3, sub( L_norm_arr( p_output_fx[sba_ch_idx], imult1616( output_frame, nchan_transport ) ), 1 ) ); + Word16 Q_p_output; + Word16 min_norm = 31; + move16(); + + FOR( ch = 0; ch < nchan_transport; ++ch ) + { + Word16 norm = L_norm_arr( p_output_fx[sba_ch_idx + ch], output_frame ); // Normalize per channel + min_norm = s_min( norm, min_norm ); + } + + Q_p_output = s_max( 3, sub( min_norm, 1 ) ); + Q_p_output = s_min( Q_p_output, 19 ); // to restrict Q-factor of p_ouptut to Q30 FOR( ch = 0; ch < nchan_transport; ch++ ) { -- GitLab