Skip to content

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_p
  • LeftFilterIncr_p
  • RightFilter_p
  • RightFilterIncr_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

  1. Check out commit 40e572ce
  2. Add a break; statement in apps/renderer.c, line 482. This will cause all calls to rendering functions to be skipped.
  3. Build IVAS_rend with msan (make CLANG=1 -j)
  4. Run ./IVAS_rend -i scripts/tests/data/spectral_test_1ch_48kHz.wav -if ISM1 -o dbg_output.wav -of BINAURAL -fs 48 -q