Memory sanitizer error in ACELP, invalid array index -1
# Basic info
<!--- Add commit SHA used to reproduce -->
Applies for current basop-main
# Bug description
Invalid array index in ACELP sanity check
# Ways to reproduce
1) Build with clang sanitizer flags :
CFLAGS += -fsanitize=address,undefined,nullability
LDFLAGS += -fsanitize=address,undefined,nullability
2) Decode attached file:
IVAS_dec -q -fr 20 -Tracefile stvOMASA_2ISM_2MASA2TC48c+10dB.wav_OMASA_2Dir2TC_2ISM_at_br_sw_techs_13_2_to_512_kbps_start_48_kbps_48kHz_in_48kHz_out_7_1_out_JBM_Prof_5.dectrace -VOIP 7_1 48 stvOMASA_2ISM_2MASA2TC48c+10dB.wav_OMASA_2Dir2TC_2ISM_at_br_sw_techs_13_2_to_512_kbps_start_48_kbps_48kHz_in_48kHz_out_7_1_out_JBM_Prof_5.netsimout out.wav
3) Output will show this message:
...
lib_dec/dec_acelp_fx.c:174:9: runtime error: index -1 out of bounds for type 'const UWord32[9]' (aka 'const unsigned int[9]')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior lib_dec/dec_acelp_fx.c:174:9 in
...
4) Proposed fix
Move sanity check inside of an IF statement a few lines lower were the invalid memory access cannot happen, and the ELSE of that IF statement would have the same effect as if the sanity check triggers.
<!--- Below are labels that will be added but are not shown in description. This is a template to help fill them.
Add further information to the first row and remove and add labels as necessary. -->
[stvOMASA_2ISM_2MASA2TC48c+10dB.wav_OMASA_2Dir2TC_2ISM_at_br_sw_techs_13_2_to_512_kbps_start_48_kbps_48kHz_in_48kHz_out_7_1_out_JBM_Prof_5.netsimout](/uploads/ddde633b7e7f0a040181e80e4833d038/stvOMASA_2ISM_2MASA2TC48c+10dB.wav_OMASA_2Dir2TC_2ISM_at_br_sw_techs_13_2_to_512_kbps_start_48_kbps_48kHz_in_48kHz_out_7_1_out_JBM_Prof_5.netsimout)
issue