Initialization issues in TD Rend Spatial parameters struct
Basic info
- Commit SHA: 40e572ce
- Platform: Linux (although expected on all platforms)
Bug description
The following struct members of SFX_SpatBin_t are left uninitialized after calling ivas_td_binaural_open:
LeftFilter_pLeftFilterIncr_pRightFilter_pRightFilterIncr_p
All of these are only initialized while rendering (in TDREND_SFX_SpatBin_SetParamsInitializeOn), so if rendering is skipped (e.g. due to an early return caused by an error) the uninitialized values are read in ivas_td_binaural_close. The most obvious fix would be to set these to NULL in TDREND_SFX_SpatBin_Initialize.
On a related note, TDREND_SFX_SpatBin_SetParamsInitializeOn seems to be called during rendering and also allocate memory using malloc. As far as I understand, we want to avoid allocations while processing. Would it be possible to pre-allocate that memory at an earlier stage?
Ways to reproduce
- Check out commit 40e572ce
- Add a
break;statement inapps/renderer.c, line 482. This will cause all calls to rendering functions to be skipped. - Build
IVAS_rendwith msan (make CLANG=1 -j) - Run
./IVAS_rend -i scripts/tests/data/spectral_test_1ch_48kHz.wav -if ISM1 -o dbg_output.wav -of BINAURAL -fs 48 -q