fix(libwebrtc): compile libfvad with -fno-sanitize=shift for the sanitizer job #15927
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15927"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-11-05T00:51:31Z.
What
guest_webrtc_vadfails in the nightly Sanitizers runs of 2026-11-02, 2026-11-03 and 2026-11-04 with3rdparty/libfvad/src/signal_processing/resample_by_2_internal.c:141:37: runtime error: left shift of negative value -32490. The sanitizer build uses-fno-sanitize-recover=undefined, so the first report stops the test.The line is in the
3rdparty/libfvadsubmodule, pinned to532ab666c20d3cfda38bca63abbb0f152706c369, which is the newest commit of the upstream repository (2024-02-19); upstream has no fix. The code shifts a negative 16-bit sample left, which is undefined in C. libfvad already marks its functions that overflow withRTC_NO_SANITIZE("signed-integer-overflow")(src/common.h:29, used atresample_by_2_internal.c:31,:127and:206and atvad/vad_core.c:115), but not this shift.This PR adds
target_compile_options(fvad PRIVATE $<$<C_COMPILER_ID:GNU,Clang,AppleClang>:-fno-sanitize=shift>)after thefvadtarget is created incore/libs/CMakeLists.txt. The consequence, stated plainly: UBSan no longer checks shifts in libfvad. Its other checks, and every other target, stay on, and the generated code is unchanged (outside the sanitizer builds the flag has no effect). A technical debt entry indocs/dev/debt/libwebrtc.mdsays so.There is no precedent in the repository for
-fno-sanitizeon a third-party target (git greponb11c7bf84f). The nearest cases are the global-fno-sanitize=functioninCMakeLists.txt:110and theno_sanitize("address")attributes on three functions of our own code. I did not take two other routes: a line in.github/sanitizer-known-failures.txtwould be permanent, because there is no upstream fix to wait for (the existingguest_vorbis_decline pointed at an upstream fix, #11480), and an UBSan suppression file for the test is not measured and has no precedent here. The repository has no mechanism to patch a submodule's files.Tested
Ubuntu 24.04, GCC 13.3, ASan + UBSan configured as in
sanitizers.yml(-fno-sanitize-recover=undefined),ASAN_OPTIONS=detect_leaks=0,UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1, on 2026-11-04 from 16:50 UTC to 16:51 UTC, onmainb11c7bf84f5d2f636ff60166cc3371bd071e24d5plus the change:guest_webrtc_vadPassed in 3 of 3 runs; the compile command ofresample_by_2_internal.ccontains-fno-sanitize=shift.core/libs/CMakeLists.txtfrom main (red): Failed in 3 of 3 runs with the message above, and the compile command does not contain the flag.core/libs/CMakeLists.txtis byte for byte the same file (blob90e03222b390362fe2563db13d464656d2f26264); only the debt entry was reworded and moved.MinGW GCC 15.2.0 (WinLibs) on Windows 10, 2026-11-04 at 17:08 UTC:
cmake -S . -B buildexited 0,ninja -C build fvadexited 0, and the compile command ofresample_by_2_internal.ccontains-fno-sanitize=shift.python -I tools/check_conventions.py --base b11c7bf84f5d2f636ff60166cc3371bd071e24d5passed at 17:10 UTC;git diff --checkis clean.Not run: Clang and AppleClang (the expression lists them; no Clang was available here), MSVC (the expression leaves it out), and the nightly's own GCC 15 on ubuntu-latest.
Overlap
Checked against main
d63781e9cewith the 1879 open PRs listed at 22:51 UTC on 2026-11-04 (scan from 22:50 UTC on 2026-11-04 to 00:03 UTC on 2026-11-05); the changed files of each PR come fromgit diff --name-onlyagainst its merge base. 67 PRs changecore/libs/CMakeLists.txt, 34 changedocs/dev/debt/libwebrtc.mdand 2 change.github/sanitizer-known-failures.txt; together they are 102 PRs. No open PR changes3rdparty/libfvadorcore/libs/tests/GuestWebrtcVad.cpp, and no open PR title mentionsfvad,webrtc_vadorresample_by_2. #15905 had no fetchable ref at that time; its file list from the API (core/libs/tests/GuestPad.cpp) does not touch these files. Measured against this head withgit merge-tree: 85 are clean. The other 17 also conflict with main alone, so this PR does not cause any of them. The branch is based onb11c7bf84f; against current main41eee370ea9a946b1a78699461042baa4f812aa8(checked on 2026-11-05 at 00:19 UTC) it merges cleanly.#15165 adds a
guest_webrtc_vadline to.github/sanitizer-known-failures.txt. It does not conflict with this PR, which does not touch that file, but once both are merged the test passes and the line would be listed as known but passed. Depends on: none.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)AI-assisted (Claude Code).
🤖 Generated with Claude Code