Skip to content

USAN: implicit conversion from signed to unsinged integer changes value in ivas_masa_dec.c

Basic info

Bug description

Clang usan sanitizer test in pipeline found an error:

lib_dec/ivas_masa_dec.c:1973:64: runtime error: implicit conversion from type 'int' of value -9 (32-bit, signed) to type 'uint8_t' (aka 'unsigned char') changed the value to 247 (8-bit, unsigned)
SUMMARY: UndefinedBehaviorSanitizer: implicit-signed-integer-truncation lib_dec/ivas_masa_dec.c:1973:64 in 

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

Ways to reproduce

Using the scripts:

python3 scripts/IvasBuildAndRunChecks.py --checks CLANG -m MASA_1TC_b64_dtx_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 -masa 1 ltv48_MASA1TC.met -dtx -max_band fb 64000 48 ltv48_MASA1TC.wav bit
./IVAS_dec ext 48 bit out.wav