Skip to content

USAN:: OOB indexing in E_GAIN_closed_loop_search_fx function (EVS)

Basic info

Bug description

USAN found an out-of-bounds indexing:

	lib_enc/enc_gain_fx.c:273:13: runtime error: index -139 out of bounds for type 'Word16 [41]'
	    #0 0x9a8d34 in E_GAIN_closed_loop_search_fx /ivas-basop/lib_enc/enc_gain_fx.c:273:13
	    #1 0x8a370a in Mode2_pit_encode_fx /ivas-basop/lib_enc/pit_enc_fx.c:1467:15
	    #2 0xd6f411 in coder_acelp_fx /ivas-basop/lib_enc/cod_ace_fx.c:234:13
	    #3 0x979082 in core_encode_openloop_fx /ivas-basop/lib_enc/core_enc_ol_fx.c:255:9
	    #4 0x9a66a5 in enc_acelp_tcx_main_fx /ivas-basop/lib_enc/enc_acelp_tcx_main_fx.c:59:13
	    #5 0x4608f5 in evs_enc_fx /ivas-basop/lib_enc/evs_enc_fx.c:313:9
	    #6 0x43d56d in IVAS_ENC_EncodeFrameToSerial /ivas-basop/lib_enc/lib_enc_fx.c:1494:13
	    #7 0x42cf18 in main /ivas-basop/apps/encoder.c:877:28
	    #8 0x7f3513dd1d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
	    #9 0x7f3513dd1e3f in __libc_start_main csu/../csu/libc-start.c:392:3
	    #10 0x4045b4 in _start (/ivas-basop/IVAS_cod+0x4045b4)

	SUMMARY: UndefinedBehaviorSanitizer: out-of-bounds-index lib_enc/enc_gain_fx.c:273: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_dmx_evs 24400 48 scripts/testv/stvST48c.wav bit