Arithmetic overflow in qmetadata encoder
The MSVC Code analysis reports several C26451 warnings in the file ivas_qmetadata_enc_fx.c:
Severity Code Description Project File Line Suppression State
Warning C26451 Arithmetic overflow: Using operator '<<' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '<<' to avoid overflow (io.2). lib_enc ..\lib_enc\ivas_qmetadata_enc_fx.c 4674 Active
Warning C26451 Arithmetic overflow: Using operator '<<' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '<<' to avoid overflow (io.2). lib_enc ..\lib_enc\ivas_qmetadata_enc_fx.c 4699 Active
Warning C26451 Arithmetic overflow: Using operator '<<' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '<<' to avoid overflow (io.2). lib_enc ..\lib_enc\ivas_qmetadata_enc_fx.c 4979 Active
Warning C26451 Arithmetic overflow: Using operator '<<' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '<<' to avoid overflow (io.2). lib_enc ..\lib_enc\ivas_qmetadata_enc_fx.c 5003 Active
Warning C26451 Arithmetic overflow: Using operator '<<' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '<<' to avoid overflow (io.2). lib_enc ..\lib_enc\ivas_qmetadata_enc_fx.c 5205 Active
Warning C26451 Arithmetic overflow: Using operator '<<' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '<<' to avoid overflow (io.2). lib_enc ..\lib_enc\ivas_qmetadata_enc_fx.c 5230 Active
Warning C26451 Arithmetic overflow: Using operator '<<' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '<<' to avoid overflow (io.2). lib_enc ..\lib_enc\ivas_qmetadata_enc_fx.c 5434 Active
Warning C26451 Arithmetic overflow: Using operator '<<' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '<<' to avoid overflow (io.2). lib_enc ..\lib_enc\ivas_qmetadata_enc_fx.c 5457 Active
Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2). lib_enc ..\lib_enc\ivas_qmetadata_enc_fx.c 4674 Active
Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2). lib_enc ..\lib_enc\ivas_qmetadata_enc_fx.c 4699 Active
Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2). lib_enc ..\lib_enc\ivas_qmetadata_enc_fx.c 4979 Active
Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2). lib_enc ..\lib_enc\ivas_qmetadata_enc_fx.c 5003 Active
Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2). lib_enc ..\lib_enc\ivas_qmetadata_enc_fx.c 5205 Active
Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2). lib_enc ..\lib_enc\ivas_qmetadata_enc_fx.c 5230 Active
Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2). lib_enc ..\lib_enc\ivas_qmetadata_enc_fx.c 5434 Active
Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2). lib_enc ..\lib_enc\ivas_qmetadata_enc_fx.c 5457 Active
A typical instance looks like follows
hMetaData->ind_list[indice_coherence + i].value = ( idx & ( ( 1 << k ) - 1 ) );
I do not see an obvious arithmetic problem here, but I think that the assignment should be at least rewritten to BASOP instructions.
@pihlajakuja, who could be the best assignee, please?