From e654efd4322168bcd73d56b8b91e3e4b0bc42a6d Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Wed, 29 Jan 2025 17:18:10 +0100 Subject: [PATCH 1/2] fix if() condition, prevent crash when CPE is NULL --- lib_enc/ivas_core_pre_proc_front.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index 79003e297..e318890c6 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -227,7 +227,9 @@ ivas_error pre_proc_front_ivas( } #ifdef DEBUG_MODE_INFO + if ( !( hCPE != NULL && hCPE->hStereoTD != NULL && n > 0 ) ) { + /* for TD stereo only write out first channel. The existence of a second channel can vary, this is just easier to handle */ int16_t tmp_dmx_in[L_FRAME48k]; mvr2s( signal_in - NS2SA( st->input_Fs, ACELP_LOOK_NS ), tmp_dmx_in, input_frame ); dbgwrite( tmp_dmx_in, sizeof( int16_t ), input_frame, 1, strcat( fname( debug_dir, "ivas_input_dmx", 0, ch_idx + 1, ENC ), ".pcm" ) ); -- GitLab From 3eaa3351688c1d7461a5509d1be3206fe7efc9b3 Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Thu, 30 Jan 2025 09:36:24 +0100 Subject: [PATCH 2/2] replace n by ch_idx --- lib_enc/ivas_core_pre_proc_front.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index e318890c6..ddea6b02a 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -227,7 +227,7 @@ ivas_error pre_proc_front_ivas( } #ifdef DEBUG_MODE_INFO - if ( !( hCPE != NULL && hCPE->hStereoTD != NULL && n > 0 ) ) + if ( !( hCPE != NULL && hCPE->hStereoTD != NULL && ch_idx > 0 ) ) { /* for TD stereo only write out first channel. The existence of a second channel can vary, this is just easier to handle */ int16_t tmp_dmx_in[L_FRAME48k]; -- GitLab