Skip to content

USAN: OOB indexing in pitch_fr4_fx function

Basic info

Bug description

USAN found an out-of-bounds indexing:

	lib_enc/pit_enc_fx.c:808:13: runtime error: index -16 out of bounds for type 'Word16 [24]'
	    #0 0x89aba9 in pitch_fr4_fx /ivas-basop/lib_enc/pit_enc_fx.c:808:13
	    #1 0x89859c in pit_encode_fx /ivas-basop/lib_enc/pit_enc_fx.c:381:27
	    #2 0x9adfdb in encod_gen_voic_ivas_fx /ivas-basop/lib_enc/enc_gen_voic_fx.c:611:24
	    #3 0x9511eb in acelp_core_enc_ivas_fx /ivas-basop/lib_enc/acelp_core_enc_fx.c:1379:13
	    #4 0xa0fc58 in ivas_core_enc_fx /ivas-basop/lib_enc/ivas_core_enc_fx.c:326:13
	    #5 0xac0fc4 in ivas_cpe_enc_fx /ivas-basop/lib_enc/ivas_cpe_enc_fx.c:1230:5
	    #6 0x485ea3 in ivas_enc_fx /ivas-basop/lib_enc/ivas_enc_fx.c:182:9
	    #7 0x43d5a8 in IVAS_ENC_EncodeFrameToSerial /ivas-basop/lib_enc/lib_enc_fx.c:1502:13
	    #8 0x42cf18 in main /ivas-basop/apps/encoder.c:877:28
	    #9 0x7fd13c58dd8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
	    #10 0x7fd13c58de3f in __libc_start_main csu/../csu/libc-start.c:392:3
	    #11 0x4045b4 in _start (/ivas-basop/IVAS_cod+0x4045b4)

	SUMMARY: UndefinedBehaviorSanitizer: out-of-bounds-index lib_enc/pit_enc_fx.c:808:13 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