Repository navigation
build: state the other get_bit1 shift and link libm where the sanitizer needs it (#2923) - #2935
Conversation
The asan lane's first run on this branch (40893068597) reports `rtmp-av1.c.h:109` still: the *left* compound shift, `result <<= index & 7`, is the one at column 20 — the `-Wconversion` diagnostic the issue table attributed to line 109 covers both shifts of the byte. State it the same way as the right shift below it: `result = (uint8_t)(result << (index & 7))`. The compound assignment already truncated modulo 256, so the cast changes no value.
With the compile diagnostics gone the valgrind lane reaches linking, where it
had never got to before, and fails on this test:
ld: .../test_scene_crop_steps.c.o: undefined reference to symbol
'ceilf@@GLIBC_2.2.5'
/usr/lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing
from command line
The sanitizer flags include `float-cast-overflow`, whose checks call
ceilf/floorf, and `libobs` links `m` privately, so it does not propagate. The
other scene-step tests already link `m` under `if(NOT MSVC)`; this one now
does too.
Masked until now: the lane stopped at the compile errors above, long before
this link.
zackees
left a comment
There was a problem hiding this comment.
Coordinator review: correct and mechanical, no value change
Checked both hunks against master 9ad455e9a.
plugins/obs-outputs/rtmp-av1.c.h:109 — result = (uint8_t)(result << (index & 7)) is exactly what the compound assignment already did: result <<= n promotes result to int, shifts, then converts back to uint8_t (mod 256). The explicit cast states that conversion; it does not add one. The matching >>= 8 - 1 on the next line was already stated by #2925, so the pair is now consistent.
test_scene_crop_steps.cmake — adding m under if(NOT MSVC) matches the 23 other tests.d/*.cmake fragments that link m this way, and the quoted link error (ceilf@@GLIBC_2.2.5, DSO missing from command line) is what a sanitized float→int cast produces when libobs links m privately. No test semantics change.
Two small notes, neither blocking:
- #2929 already carries the rtmp-hevc conversions and #2922 the mp4-mux one, so the "Still open for a green lane" paragraph will read oddly once those land — worth a one-line update when #2922 merges.
562079974/3be224fd1in the body reads like a truncated commit pair; double-check it is the intended reference.
Verdict: correct and mechanical — no value change at either site. OK to queue once checks finish.
|
Handed off to the coordinator Local gate run on this branch; HEAD stamped and pushed unchanged; auto-merge on (the PR reports it is already queued). Remaining work on #2923 (the valgrind v4l2 format mismatch) stays open on the issue. |
Refs #2923. The two commits #2925 was missing when it merged.
#2925 (
6c5fd4516on master) stated the conversions and thegl_enable_debugprototype the Sanitizers lane reported. Two more findings came out of theSanitizersdispatches on that branch, and they are here:1.
get_bit1()'s left shiftasan 🧪on 40893068597 (artifactsanitize-asan) still reportedrtmp-av1.c.h:109. Line 109 is the left compound shiftresult <<= index & 7; #2925 had only stated the right shift one line below (>>= 8 - 1), because the issue's table paired both diagnostics with that line.562079974/3be224fd1states it the same way. The compound assignment already truncated modulo 256, so no value changes.2.
test_scene_crop_stepsneedslibmwhen sanitizedvalgrind 🧪on the same branch builds all 2204 targets and then fails at link, which it never reached before because the compile errors stopped the build:The lane's global
-fsanitize=undefined,float-cast-overflowmakes UBSan emitceilf/floorfcalls for the float→int casts, andlibobslinksmprivately so it does not propagate. The other scene-step tests already linkmunderif(NOT MSVC);test_scene_crop_stepsnow does the same.GREEN
Replay through the compile database on this base,
-D_DEBUG, the three groups +-Werrorappended:./lintclean (== lane lint: ok).ninja -C build test_scene_crop_stepsdoes not exist in this checkout's configuration (cmocka tests are off there), so the CMake change is verified by configuration + the lane, not by a local build of that target.Still open for a green lane
plugins/obs-outputs/mp4-mux.c.h:524(asan) andplugins/obs-outputs/rtmp-hevc.c.h:853(macOS) are on #2922, which is still open. With both PRs in, the Sanitizers and macOS lanes have nothing left from the #2625 ratchet window.Tiers
No Rust, C-test or protocol change; every edit states a conversion the compiler already performed, or links the library the sanitizer runtime calls. Nothing user-visible.