USAN: Division by zero in swb_tbe_com.c
Basic info
- Commit SHA: 472d3527
Bug description
Clang usan sanitizer test in pipeline found an error:
lib_com/swb_tbe_com.c:967:28: runtime error: division by zero
SUMMARY: UndefinedBehaviorSanitizer: float-divide-by-zero lib_com/swb_tbe_com.c:967:28 in
lib_com/tools.c:1053:11: runtime error: -nan is outside the range of representable values of type 'short'
The respective code line is:
/* normalize gain */
g = g2 / ( g1 + g2 );
The second reported error happens later in the function at line 982 where the resulting nan value is used.
The error is reported for the very first frame. Adding a small epsilon to the denominator here would mechanically fix this (assuming that both g1
and g2
are always positive), but the respective technology provider should take a closer look (I assume Huawei, but please feel free to reassign).
Link to test pipeline: https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/jobs/218855
Ways to reproduce
Using the scripts:
python3 scripts/IvasBuildAndRunChecks.py --checks CLANG3 -m stereo_b32_dtx_swb_cbr -p /path/to/my/local/ci_linux_ltv_local.json --usan_supp_file scripts/ubsan.supp
or directly:
make clean
make -j CLANG=3
./IVAS_cod -stereo -dtx -max_band swb 32000 32 ltv32_STEREO.wav bit