USAN: undefined behavior in unified-stereo decoder in ivas-float-update
Basic info
Bug description
With the encoder command
./IVAS_cod -stereo 32000 48 scripts/testv/stvST48c.wav bit
the error insertion
eid-xor -fer -vbr -bs g192 -ep g192 bit scripts/dly_error_profiles/ep_18pct_longburst.g192 bit_err
and the decoder command
./IVAS_dec -q -fr 20 STEREO 48 bit_err dec.wav
and CLANG=1, one finds the following error
lib_dec/inov_dec.c:123:47: runtime error: implicit conversion from type 'uint16_t' (aka 'unsigned short') of value 51001 (16-bit, unsigned) to type 'int16_t' (aka 'short') changed the value to -14535 (16-bit, signed)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior lib_dec/inov_dec.c:123:47
lib_dec/ACcontextMapping_dec.c:665:17: runtime error: implicit conversion from type 'int' of value 975904 (32-bit, signed) to type 'uint16_t' (aka 'unsigned short') changed the value to 58400 (16-bit, unsigned)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior lib_dec/ACcontextMapping_dec.c:665:17
lib_com/enh40.c:877:19: runtime error: implicit conversion from type 'Word16' (aka 'short') of value -32768 (16-bit, signed) to type 'UWord16' (aka 'unsigned short') changed the value to 32768 (16-bit, unsigned)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior lib_com/enh40.c:877:19
lib_dec/FEC_HQ_phase_ecu.c:2127:14: runtime error: implicit conversion from type 'int' of value 32979 (32-bit, signed) to type 'int16_t' (aka 'short') changed the value to -32557 (16-bit, signed)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior lib_dec/FEC_HQ_phase_ecu.c:2127:14
lib_dec/FEC_HQ_phase_ecu.c:2111:20: runtime error: implicit conversion from type 'int' of value 33600 (32-bit, signed) to type 'int16_t' (aka 'short') changed the value to -31936 (16-bit, signed)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior lib_dec/FEC_HQ_phase_ecu.c:2111:20
lib_com/trans_inv.c:841:33: runtime error: index -120 out of bounds for type 'float[960]'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior lib_com/trans_inv.c:841:33
Edited by Dominik Weckbecker