undefined code behavior - exposed in Fsanitize=undefined
We have observed 2 issues during testing of latest IVAS BASOP code (with STV cases) :
- Array index goes out of bound
- Shift amount for W_shr BASOP turns out to be 64 or more.
Both these issues are observed with sanitizer tests (USAN) :
-
Issue 1 : lib_com/ifft_rel.c:149:26: runtime error: index 192 out of bounds for type 'const Word16[161]' (aka 'const short[161]')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior lib_com/ifft_rel.c:149:26 in
-
Issue 2 : lib_com/enh64.c:262:32: runtime error: shift exponent 64 is too large for 64-bit type 'long long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior lib_com/enh64.c:262:32
Following command lines can be used to reproduce the issues reported :
Command 1 : ./IVAS_dec -q -fr 20 HOA3 48 stv714MC48c.wav_Multi_channel_7_1_4_bitrate_switching_from_13_2_kbps_to_512_kbps_48kHz_in_48kHz_out_HOA3_out.192 stv714MC48c.wav_Multi_channel_7_1_4_bitrate_switching_from_13_2_kbps_to_512_kbps_48kHz_in_48kHz_out_HOA3_out.dec.wav
Command 2 : ./IVAS_dec -q -fr 20 -hrtf /scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin BINAURAL 48 stv714MC48c.wav_Multi_channel_7_1_4_bitrate_switching_from_13_2_kbps_to_512_kbps_48kHz_in_48kHz_out_BINAURAL_out_Model_from_file_.192 stv714MC48c.wav_Multi_channel_7_1_4_bitrate_switching_from_13_2_kbps_to_512_kbps_48kHz_in_48kHz_out_BINAURAL_out_Model_from_file_.dec.wav
These warnings are not seen sanitizer test run on GitLab because those are ignored in : 3adbd6fb
We think such issues are serious and should be fixed.