[CI] Testing for undefined behaviour in MR pipeline - documenting suppressed errors
A job running the undefined behaviour sanitizer (UBSAN) has been added to the MR pipeline. Recently, a lot of UBSAN issues were fixed, but there are still a lot of other errors reported. It may not be necessary/possible to fix all of them - a lot might simply be uncritical or irrelevant and some are inherited from EVS. Therefore, those errors will be suppressed in the MR test job runs by means of a suppression file which will be added to the scripts/ folder. This issue is intended to document the initial list of suppressed errors and have room for possible discussion on whether those need to be fixed or not. Below, the reported errors are listed and categorized.
Note, that these are only the errors that are found when running the modes in scripts/config/self_test.prm
with the UBSAN. There are no UBSAN tests with the ltv vectors in place yet.
Note about the "implicit conversion from type"-errors: this is by far the error type that happens the most. It is unclear whether all of these need to be fixed or simply have no impact and can stay ignored. From my experience so far, a lot of those happen at startup (in frame 0) and the garbage values are probably overwritten with meaningful stuff later on.
scripts/ubsan.supp
so that new errors are not potentially shadowed.
Errors in IVAS codec:
- those are only from files that start with
ivas*
- Not listed here anymore, because separate issues are there for those already
Errors in EVS-related code:
- note that the EVS-relatedness was determined simply by the file not having an
ivas
prefix, the actual cause of the error can very well come from the ivas parts
lib_com/ACcontextMapping.c:62:9," runtime error:implicit conversion from type 'int' of value -336 (32-bit, signed) to type 'uint32_t' (aka 'unsigned int') changed the value to 4294966960 (32-bit, unsigned)"
lib_com/bitstream.c:1640:17," runtime error:implicit conversion from type 'uint16_t' (aka 'unsigned short') of value 65076 (16-bit, unsigned) to type 'int16_t' (aka 'short') changed the value to -460 (16-bit, signed)"
lib_com/longarith.c:164:20," runtime error:implicit conversion from type 'int' of value 196200 (32-bit, signed) to type 'uint16_t' (aka 'unsigned short') changed the value to 65128 (16-bit, unsigned)"
lib_com/longarith.c:166:16," runtime error:implicit conversion from type 'int' of value 208728 (32-bit, signed) to type 'uint16_t' (aka 'unsigned short') changed the value to 12120 (16-bit, unsigned)"
lib_com/tcq_position_arith.c:121:40," runtime error:implicit conversion from type 'unsigned int' of value 2147483648 (32-bit, unsigned) to type 'Word32' (aka 'int') changed the value to -2147483648 (32-bit, signed)"
lib_com/tcq_position_arith.c:1482:21," 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)"
lib_com/tools.c:1594:13," runtime error:implicit conversion from type 'int' of value 65534 (32-bit, signed) to type 'int16_t' (aka 'short') changed the value to -2 (16-bit, signed)"
lib_com/tools.c:1618:13," runtime error:implicit conversion from type 'int' of value 65534 (32-bit, signed) to type 'int16_t' (aka 'short') changed the value to -2 (16-bit, signed)"
lib_com/trans_direct.c:103:25, runtime error:index -120 out of bounds for type 'float [960]'
lib_com/trans_inv.c:841:33, runtime error:index -120 out of bounds for type 'float [960]'
lib_dec/ACcontextMapping_dec.c:655:17," runtime error:implicit conversion from type 'int' of value 947216 (32-bit, signed) to type 'uint16_t' (aka 'unsigned short') changed the value to 29712 (16-bit, unsigned)"
lib_dec/avq_dec.c:358:22," runtime error:implicit conversion from type 'int16_t' (aka 'short') of value -29440 (16-bit, signed) to type 'uint16_t' (aka 'unsigned short') changed the value to 36096 (16-bit, unsigned)"
lib_dec/cng_dec.c:280:36," runtime error:implicit conversion from type 'long' of value 2147483646 (64-bit, signed) to type 'int16_t' (aka 'short') changed the value to -2 (16-bit, signed)"
lib_dec/cng_dec.c:499:40," runtime error:implicit conversion from type 'long' of value 33022 (64-bit, signed) to type 'int16_t' (aka 'short') changed the value to -32514 (16-bit, signed)"
lib_dec/dec4t64.c:132:35," runtime error:implicit conversion from type 'uint16_t' (aka 'unsigned short') of value 55847 (16-bit, unsigned) to type 'int16_t' (aka 'short') changed the value to -9689 (16-bit, signed)"
lib_dec/dec_acelp.c:175:19, runtime error:index -1 out of bounds for type 'const uint32_t [9]'
lib_dec/dec_prm.c:960:30," runtime error:implicit conversion from type 'uint16_t' (aka 'unsigned short') of value 62074 (16-bit, unsigned) to type 'int16_t' (aka 'short') changed the value to -3462 (16-bit, signed)"
lib_dec/dec_tcx.c:1169:25," runtime error:implicit conversion from type 'int' of value 33168 (32-bit, signed) to type 'int16_t' (aka 'short') changed the value to -32368 (16-bit, signed)"
lib_dec/hdecnrm.c:176:13," runtime error:implicit conversion from type 'int' of value 70080 (32-bit, signed) to type 'uint16_t' (aka 'unsigned short') changed the value to 4544 (16-bit, unsigned)"
lib_dec/hq_lr_dec.c:1154:33, runtime error:left shift of negative value -3
lib_dec/inov_dec.c:123:47," runtime error:implicit conversion from type 'uint16_t' (aka 'unsigned short') of value 65076 (16-bit, unsigned) to type 'int16_t' (aka 'short') changed the value to -460 (16-bit, signed)"
lib_dec/jbm_jb4sb.c:778:33," runtime error:implicit conversion from type 'int32_t' (aka 'int') of value -40 (32-bit, signed) to type 'unsigned int' changed the value to 4294967256 (32-bit, unsigned)"
lib_dec/jbm_pcmdsp_apa.c:1043:18," runtime error:implicit conversion from type 'uint16_t' (aka 'unsigned short') of value 65188 (16-bit, unsigned) to type 'int16_t' (aka 'short') changed the value to -348 (16-bit, signed)"
lib_dec/jbm_pcmdsp_apa.c:1053:22," runtime error:implicit conversion from type 'int16_t' (aka 'short') of value -348 (16-bit, signed) to type 'uint16_t' (aka 'unsigned short') changed the value to 65188 (16-bit, unsigned)"
lib_dec/lib_dec.c:1724:14," runtime error:implicit conversion from type 'int' of value 412 (32-bit, signed) to type 'uint8_t' (aka 'unsigned char') changed the value to 156 (8-bit, unsigned)"
lib_dec/pvq_core_dec.c:116:23," runtime error:implicit conversion from type 'int' of value 32768 (32-bit, signed) to type 'int16_t' (aka 'short') changed the value to -32768 (16-bit, signed)"
lib_dec/tonalMDCTconcealment.c:159:23," runtime error:implicit conversion from type 'uint16_t' (aka 'unsigned short') of value 48224 (16-bit, unsigned) to type 'int16_t' (aka 'short') changed the value to -17312 (16-bit, signed)"
lib_dec/tonalMDCTconcealment.c:161:60," runtime error:implicit conversion from type 'int16_t' (aka 'short') of value -17312 (16-bit, signed) to type 'uint16_t' (aka 'unsigned short') changed the value to 48224 (16-bit, unsigned)"
lib_enc/ACcontextMapping_enc.c:1340:17," runtime error:implicit conversion from type 'int' of value 946962 (32-bit, signed) to type 'uint16_t' (aka 'unsigned short') changed the value to 29458 (16-bit, unsigned)"
lib_enc/ACcontextMapping_enc.c:966:17," runtime error:implicit conversion from type 'int' of value 947218 (32-bit, signed) to type 'uint16_t' (aka 'unsigned short') changed the value to 29714 (16-bit, unsigned)"
lib_enc/cod4t64.c:284:52," runtime error:implicit conversion from type 'int16_t' (aka 'short') of value -9689 (16-bit, signed) to type 'uint16_t' (aka 'unsigned short') changed the value to 55847 (16-bit, unsigned)"
lib_enc/cod4t64_fast.c:193:24," runtime error:implicit conversion from type 'int' of value -1 (32-bit, signed) to type 'enum TRACKPOS' changed the value to 4294967295 (32-bit, unsigned)"
lib_enc/cod_tcx.c:1507:22," runtime error:implicit conversion from type 'int' of value 33168 (32-bit, signed) to type 'int16_t' (aka 'short') changed the value to -32368 (16-bit, signed)"
lib_enc/enc_acelp.c:1220:18," runtime error:implicit conversion from type 'uint16_t' (aka 'unsigned short') of value 65076 (16-bit, unsigned) to type 'int16_t' (aka 'short') changed the value to -460 (16-bit, signed)"
lib_enc/enc_acelp.c:495:15, runtime error:index -1 out of bounds for type 'float [256]'
lib_enc/enc_gain.c:163:13, runtime error:index -139 out of bounds for type 'float [41]'
lib_enc/enc_prm.c:888:42," runtime error:implicit conversion from type 'int16_t' (aka 'short') of value -3462 (16-bit, signed) to type 'uint16_t' (aka 'unsigned short') changed the value to 62074 (16-bit, unsigned)"
lib_enc/inov_enc.c:289:68," runtime error:implicit conversion from type 'int16_t' (aka 'short') of value -460 (16-bit, signed) to type 'uint16_t' (aka 'unsigned short') changed the value to 65076 (16-bit, unsigned)"
lib_enc/pvq_core_enc.c:127:23," runtime error:implicit conversion from type 'int' of value 32768 (32-bit, signed) to type 'int16_t' (aka 'short') changed the value to -32768 (16-bit, signed)"
lib_enc/range_enc.c:268:63," runtime error:implicit conversion from type 'int16_t' (aka 'short') of value -10780 (16-bit, signed) to type 'uint16_t' (aka 'unsigned short') changed the value to 54756 (16-bit, unsigned)"
lib_enc/range_enc.c:273:65," runtime error:implicit conversion from type 'int16_t' (aka 'short') of value -14147 (16-bit, signed) to type 'uint16_t' (aka 'unsigned short') changed the value to 51389 (16-bit, unsigned)"
lib_enc/swb_tbe_enc.c:1264:31, runtime error:division by zero
Errors in BASOP-related code:
- do we need to care about those?
lib_com/basop32.c:1327:24, runtime error: signed integer overflow:2147450880 + 32768 cannot be represented in type 'int'
lib_com/basop32.c:2359:31, runtime error:left shift of negative value -660
lib_com/enh1632.c:290:32, runtime error:left shift of 1143472128 by 1 places cannot be represented in type 'Word32' (aka 'int')
lib_com/enh40.c:1000:91, runtime error:left shift of negative value -327795584
lib_com/enh40.c:1006:23," runtime error:implicit conversion from type 'UWord32' (aka 'unsigned int') of value 4290870530 (32-bit, unsigned) to type 'Word32' (aka 'int') changed the value to -4096766 (32-bit, signed)"
lib_com/enh40.c:919:19," runtime error:implicit conversion from type 'Word16' (aka 'short') of value -22528 (16-bit, signed) to type 'UWord16' (aka 'unsigned short') changed the value to 43008 (16-bit, unsigned)"
lib_com/enh40.c:923:70, runtime error:left shift of negative value -110184192
lib_com/enh40.c:930:23," runtime error:implicit conversion from type 'UWord32' (aka 'unsigned int') of value 4280309465 (32-bit, unsigned) to type 'Word32' (aka 'int') changed the value to -14657831 (32-bit, signed)"
lib_com/enh40.c:988:19," runtime error:implicit conversion from type 'Word16' (aka 'short') of value -9874 (16-bit, signed) to type 'UWord16' (aka 'unsigned short') changed the value to 55662 (16-bit, unsigned)"
lib_com/enh40.c:990:19," runtime error:implicit conversion from type 'Word16' (aka 'short') of value -12013 (16-bit, signed) to type 'UWord16' (aka 'unsigned short') changed the value to 53523 (16-bit, unsigned)"
lib_com/enh40.c:999:91, runtime error:left shift of negative value -8323072
lib_com/enh40.h:289:31, runtime error:left shift of negative value -7347825
Errors in non-codec part of the software (such as lib_util
):
- probably irrelevant for us, so rather no need to fix
lib_util/hrtf_file_reader.c:1088:47," runtime error:load of misaligned address 0x00000340a022 for type 'float', which requires 4 byte alignment"
lib_util/hrtf_file_reader.c:1139:47," runtime error:load of misaligned address 0x00000340a022 for type 'float', which requires 4 byte alignment"
lib_util/hrtf_file_reader.c:836:45," runtime error:load of misaligned address 0x000004ec4aa6 for type 'float', which requires 4 byte alignment"
How to reproduce/investigate one of those errors
- build with usan:
make clean; make -j CLANG=3
- run selftest:
python3 scripts/self_test.py --create
- grep through the logs for the error occurence spot, e.g.:
grep hrtf_file_reader scripts/ref/logs/*
How to generate the boiled-down duplicates-removed list of errors:
- Use this script after running the selftest: get_unique_usan_errors.py