Skip to content

USAN: out-of-bounds-index in lib_enc/enc_acelp.c:495:15

Basic Info

Bug description

Clang USAN found an out-of-bounds-index error at lib_enc/enc_acelp.c:495:15:

lib_enc/enc_acelp.c:495:15: runtime error: index -1 out of bounds for type 'float [256]'
#0 0xb536a0 in E_ACELP_corrmatrix /builds/rep/ivas-codec-pc/ivas-codec/lib_enc/enc_acelp.c:495:15
#1 0xb421b1 in E_ACELP_4tsearch /builds/rep/ivas-codec-pc/ivas-codec/lib_enc/enc_acelp.c:734:5
#2 0xb6185f in E_ACELP_4t /builds/rep/ivas-codec-pc/ivas-codec/lib_enc/enc_acelp.c:1087:9
#3 0x50ca25 in inov_encode /builds/rep/ivas-codec-pc/ivas-codec/lib_enc/inov_enc.c:282:25
#4 0xb9a180 in encod_tran /builds/rep/ivas-codec-pc/ivas-codec/lib_enc/enc_tran.c:167:9
#5 0xa75bd4 in acelp_core_enc /builds/rep/ivas-codec-pc/ivas-codec/lib_enc/acelp_core_enc.c:532:13
#6 0xc6526a in ivas_core_enc /builds/rep/ivas-codec-pc/ivas-codec/lib_enc/ivas_core_enc.c:245:28
#7 0x77fe92 in ivas_sce_enc /builds/rep/ivas-codec-pc/ivas-codec/lib_enc/ivas_sce_enc.c:270:20
#8 0x51a14f in ivas_enc /builds/rep/ivas-codec-pc/ivas-codec/lib_enc/ivas_enc.c:255:28
#9 0x44dee3 in IVAS_ENC_EncodeFrameToSerial /builds/rep/ivas-codec-pc/ivas-codec/lib_enc/lib_enc.c:1342:24
#10 0x42d0d2 in main /builds/rep/ivas-codec-pc/ivas-codec/apps/encoder.c:882:28
#11 0x7f7a60666d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#12 0x7f7a60666e3f in __libc_start_main csu/../csu/libc-start.c:392:3
#13 0x404774 in _start (/builds/rep/ivas-codec-pc/ivas-codec/IVAS_cod+0x404774)

SUMMARY: UndefinedBehaviorSanitizer: out-of-bounds-index lib_enc/enc_acelp.c:495:15 in

How to reproduce

Build with

make clean
make -j CLANG=3
export UBSAN_OPTIONS=report_error_type=1,print_stacktrace=1

Then run

IVAS_cod -dtx -sba 1 scripts/switchPaths/sw_13k2_192k_50fr.bin 32 scripts/testv/stvFOA32n.wav stvFOA32n.wav_SBA_FOA_bitrate_switching_from_13_2_kbps_to_192_kbps_32kHz_in_32kHz_out_DTX_on_EXT_out.192

or

python3 -m pytest "test_param_file_tests[stv-SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 32kHz in, 32kHz out, DTX on, EXT out]" -n auto --update_ref --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec