diff --git a/lib_com/options.h b/lib_com/options.h index 68c2542f2e4d80a3414d046ba67db96565a3dfad..89a69290babbc92f45a12a742423d15f5ec91cd7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -104,4 +104,5 @@ #define FIX_1100_REMOVE_LPC_RESCALING /* VA: Remove the rescaling of LPC coefficient to Q12 as residu and syn-filt are already taking care of it*/ #define FIX_ISSUE_1122 /* Ittiam: Fix issue 1122: corrected incorrect scaling of a buffer leading to incorrect metadata bits */ +#define FIX_1132_STACK_CORRUPTION /* Stack corruption issue due of extending index access*/ #endif diff --git a/lib_enc/ivas_stereo_switching_enc.c b/lib_enc/ivas_stereo_switching_enc.c index ba84be1a2000f4ada3bb3b6fc5e901d993dae781..63a44ab5e5d4fdffc356b5a2a554b82cbf6a9346 100644 --- a/lib_enc/ivas_stereo_switching_enc.c +++ b/lib_enc/ivas_stereo_switching_enc.c @@ -241,7 +241,16 @@ ivas_error stereo_memory_enc_fx( test(); IF( hCPE->hStereoTCA != NULL && EQ_16( hCPE->last_element_mode, IVAS_CPE_DFT ) ) { +#ifdef FIX_1132_STACK_CORRUPTION + Word16 tmp = extract_h( abs( hCPE->hStereoDft->hItd->itd_fx[1] ) ); + if ( hCPE->hStereoDft->hItd->itd_fx[1] < 0 ) + { + tmp = negate( tmp ); + } + set16_fx( hCPE->hStereoTCA->prevCorrLagStats, tmp, 3 ); +#else set16_fx( hCPE->hStereoTCA->prevCorrLagStats, extract_h( hCPE->hStereoDft->hItd->itd_fx[1] ), 3 ); +#endif IF( hCPE->hStereoDft->hItd->itd_fx[1] >= 0 ) { hCPE->hStereoTCA->prevRefChanIndx = L_CH_INDX;