Skip to content

USAN errors in igf_scf_dec for MC 5.1 decoding at 80kbps

Basic info

Bug description

Clang usan sanitizer test in pipeline found an error:

lib_dec/igf_scf_dec.c:252:24: runtime error: implicit conversion from type 'int' of value -1 (32-bit, signed) to type 'uint16_t' (aka 'unsigned short') changed the value to 65535 (16-bit, unsigned)
SUMMARY: UndefinedBehaviorSanitizer: implicit-signed-integer-truncation lib_dec/igf_scf_dec.c:252:24 in 
lib_dec/igf_scf_dec.c:255:24: runtime error: implicit conversion from type 'int' of value 65551 (32-bit, signed) to type 'int16_t' (aka 'short') changed the value to 15 (16-bit, signed)
SUMMARY: UndefinedBehaviorSanitizer: implicit-signed-integer-truncation lib_dec/igf_scf_dec.c:255:24 in

Link to test pipeline: https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/jobs/204423

Ways to reproduce

Using the scripts:

python3 scripts/IvasBuildAndRunChecks.py --checks CLANG3 -m MC_5_1_b80_fb_cbr -p /path/to/my/local/ci_linux_ltv_local.json --usan_supp_file scripts/ubsan.supp

or directly:

make clean
make -j CLANG=3
./IVAS_cod -mc 5_1 -max_band fb 80000 48 ltv48_MC51.wav bit
./IVAS_dec mono 48 bit out.wav