Skip to content

USAN "implicit-signed-integer-truncation" in IGF decoding

Basic info

Bug description

Clang3 (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 65537 (32-bit, signed) to type 'int16_t' (aka 'short') changed the value to 1 (16-bit, signed)
SUMMARY: UndefinedBehaviorSanitizer: implicit-signed-integer-truncation lib_dec/igf_scf_dec.c:255:24 in 
Input bitstream file:   ltv48_MASA2TC_MASA_2TC_b64_fb_cbr.192
Output synthesis file:  ltv48_MASA2TC_MASA_2TC_b64_fb_cbr.dec.BINAURAL.wav

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

Ways to reproduce

Using the scripts:

python3 scripts/IvasBuildAndRunChecks.py --checks CLANG3 -m MASA -p /path/to/my/local/ci_linux_ltv_local.json

or directly:

make clean
make -j CLANG=3
./IVAS_cod -masa 1 ivas-pc-testfiles/ltv48_MASA1TC.met -max_band fb 64000 48 ivas-codec/CLANG3/pcm/ltv48_MASA1TC_48_MASA1TC_L0-120_0s.pcm ltv48_MASA1TC_MASA_1TC_b64_fb_cbr.192
./IVAS_dec BINAURAL 48 ltv48_MASA2TC_MASA_2TC_b64_fb_cbr.192 ltv48_MASA2TC_MASA_2TC_b64_fb_cbr.dec.BINAURAL.wav