Skip to content

MSAN: use-of-uninitialized-value in SBA WB decoder and rate switching

Basic info

  • Commit SHA: main
  • Platform: all (but needs Linux to run sanitisers)

Bug description

MSAN (CLANG1) sanitiser reports this kind of error when input/output is 16 kHz and rate switching is used

Frames processed:       63      ==291897==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x8972bd in ivas_spar_get_skip_mat /ivasrepo/lib_dec/ivas_spar_decoder.c:987:30
    #1 0x8912b2 in ivas_spar_dec_upmixer_sf /ivasrepo/lib_dec/ivas_spar_decoder.c:1569:5
    #2 0x88eeed in ivas_spar_dec_upmixer /ivasrepo/lib_dec/ivas_spar_decoder.c:1391:9
    #3 0x86c875 in ivas_sba_upmixer_renderer /ivasrepo/lib_dec/ivas_sba_rendering_internal.c:403:5
    #4 0x60feea in ivas_dec /ivasrepo/lib_dec/ivas_dec.c:510:13
    #5 0x503551 in IVAS_DEC_GetSamples /ivasrepo/lib_dec/lib_dec.c:850:24
    #6 0x4f31f7 in decodeG192 /ivasrepo/apps/decoder.c:2002:24
    #7 0x4d8c85 in main /ivasrepo/apps/decoder.c:700:17
    #8 0x7efe4f062082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
    #9 0x45557d in _start (/ivasrepo/build-msan/IVAS_dec+0x45557d)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /ivasrepo/lib_dec/ivas_spar_decoder.c:987:30 in ivas_spar_get_skip_mat

Ways to reproduce

For example this pipeline run https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/pipelines/20082

This can be reproduced on Linux, e.g., with following steps in main branch root

cmake . -Bbuild-msan -DCMAKE_C_COMPILER=clang -DCLANG=msan
cmake --build build-msan -- -j16
cd build-msan
sox ltv48_HOA3.wav -r 16000 ltv16_HOA3.wav
./IVAS_cod -sba 3 -max_band WB ../scripts/switchPaths/sw_13k2_512k.bin 16 ltv16_HOA3.wav debugsba.bts
./IVAS_dec 5_1 16 debugsba.bts out.wav

This should do what the sanitiser test does. Sox can be replaced with any other resampling tool and ltv48_HOA3.wav is obtained from the ivas-pc-testfiles repository.

However, seems that you can just directly use the 48 kHz input without resampling, i.e., this

cmake . -Bbuild-msan -DCMAKE_C_COMPILER=clang -DCLANG=msan
cmake --build build-msan -- -j16
cd build-msan
./IVAS_cod -sba 3 -max_band WB ../scripts/switchPaths/sw_13k2_512k.bin 48 ltv48_HOA3.wav debugsba.bts
./IVAS_dec 5_1 16 debugsba.bts out.wav

which is a bit easier.