USAN: nullpointer-with-nonzero-offset in MASA decoding
There is still one undefined behaviour error in the ivas-prefixed part of the code:
UndefinedBehaviorSanitizer: nullptr-with-nonzero-offset lib_dec/ivas_dirac_dec.c:1815:56 in
This gets triggered by some MASA decoder tests, see here: https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/jobs/175954.
code part in ivas_dirac_dec.c:1815
:
reference_power = DirAC_mem.reference_power;
reference_power_smooth = DirAC_mem.reference_power + hSpatParamRendCom->num_freq_bands; // <--- this is the line that triggers the error
The error probably has no effect as the use of the pointer later is guarded by if-clauses, e.g.:
if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD )
{
set_zero( reference_power_smooth, hSpatParamRendCom->num_freq_bands );
}
The same condition could maybe be added to erroneous code part, e.g.:
reference_power = DirAC_mem.reference_power;
reference_power_smooth = NULL;
if ( reference_power != NULL )
{
reference_power_smooth = DirAC_mem.reference_power + hSpatParamRendCom->num_freq_bands;
}
If this gets fixed, at least the ivas*.c part of the code would be undefined-behaviour-free (at least for all the scenarios that we are currently testing). Also we could remove this file from the ignore list of the undef behaviour sanitizer which would prevent newly introduced (and maybe more serious) usan errors would not get shadowed.