Skip to content

USAN: OOB indexing in E_ACELP_corrmatrix_fx function

Basic info

Bug description

USAN found an out-of-bounds indexing:

	lib_enc/enc_acelp_fx.c:1000:15: runtime error: index -1 out of bounds for type 'Word16 [256]'
	    #0 0x98adde in E_ACELP_corrmatrix_fx /ivas-basop/lib_enc/enc_acelp_fx.c:1000:15
	    #1 0x990bf0 in E_ACELP_4tsearch_fx /ivas-basop/lib_enc/enc_acelp_fx.c:1218:5
	    #2 0x99b9c2 in E_ACELP_4t_fx /ivas-basop/lib_enc/enc_acelp_fx.c:1544:9
	    #3 0x481630 in inov_encode_ivas_fx /ivas-basop/lib_enc/inov_enc_fx.c:641:25
	    #4 0x9ae575 in encod_gen_voic_ivas_fx /ivas-basop/lib_enc/enc_gen_voic_fx.c:663:9
	    #5 0x9511eb in acelp_core_enc_ivas_fx /ivas-basop/lib_enc/acelp_core_enc_fx.c:1379:13
	    #6 0xa0fc58 in ivas_core_enc_fx /ivas-basop/lib_enc/ivas_core_enc_fx.c:326:13
	    #7 0xac0fc4 in ivas_cpe_enc_fx /ivas-basop/lib_enc/ivas_cpe_enc_fx.c:1230:5
	    #8 0x485ea3 in ivas_enc_fx /ivas-basop/lib_enc/ivas_enc_fx.c:182:9
	    #9 0x43d5a8 in IVAS_ENC_EncodeFrameToSerial /ivas-basop/lib_enc/lib_enc_fx.c:1502:13
	    #10 0x42cf18 in main /ivas-basop/apps/encoder.c:877:28
	    #11 0x7fd13c58dd8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
	    #12 0x7fd13c58de3f in __libc_start_main csu/../csu/libc-start.c:392:3
	    #13 0x4045b4 in _start (/ivas-basop/IVAS_cod+0x4045b4)

	SUMMARY: UndefinedBehaviorSanitizer: out-of-bounds-index lib_enc/enc_acelp_fx.c:1000:15 in 

It needs to be checked if this is an actual bug or a somewhat "false positive" that is assigned, but never really used. In any case, it is preferable to fix this to have one less noise in the USAN error reports.

Ways to reproduce

make clean
make -j CLANG=3
IVAS_cod -stereo -dtx 13200 32 scripts/testv/stvST32n.wav bit