Repository navigation
fix(libobs): check the core before taking &obs->audio (#3363) - #3418
Merged
Merged
Conversation
) Drop the two known-list entries of #3363, so the asan job counts the UBSan reports again: libobs/obs.c.h:1624:25: runtime error: member access within null pointer of type 'struct obs_core' (obs_reset_audio2, from test_core_setup_rules_steps) libobs/obs.c.h:1747:25: runtime error: member access within null pointer of type 'struct obs_core' (obs_get_audio_info2, from test_no_core_getters) Fails: the asan job (sanitizers.yaml, tools=asan) on these two tests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
obs_reset_audio2() and obs_get_audio_info2() took &obs->audio before they checked for a core, which is undefined behaviour with obs == NULL even though neither read through it. obs_reset_audio2() now asks the core rule first and takes the address only after it passed; the active-output rule follows as before. obs_get_audio_info2() returns false with no core first, as obs_get_audio_info() does (#2566). Both return what they returned before; only the null-pointer arithmetic goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=30e450504aa5ed6700cc0f4eb48bcce1980c240c secs=258 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run,macos-native:n/a,windows-native:n/a Ci-Attestation: {"at":1793531881,"gate":"rust/all/fmt","host":"linux-x86_64","key":"4017a78c343956927bd418294eddc1b23beb1216e68cab781eb70dfbc1d7bf66","lane":"lint","parents":["949785e0207bf04e288e1fc76e2116aecace8bb9"],"secs":79,"stamp":"4c6e5e31cef2d80aabf6dc6a1b3b889b","tree":"30e450504aa5ed6700cc0f4eb48bcce1980c240c","v":1,"via":"run"} Ci-Attestation: {"at":1793531881,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"4017a78c343956927bd418294eddc1b23beb1216e68cab781eb70dfbc1d7bf66","lane":"lint","parents":["949785e0207bf04e288e1fc76e2116aecace8bb9"],"secs":79,"stamp":"e2613e95e85a34c14b8337603ae09ba5","tree":"30e450504aa5ed6700cc0f4eb48bcce1980c240c","v":1,"via":"run"} Ci-Attestation: {"at":1793531881,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"dfb087ab66ad1dedabe570087a1c005f886c72afd3beac2577bba9fb3d7b4208","lane":"rust-test","parents":["949785e0207bf04e288e1fc76e2116aecace8bb9"],"secs":89,"stamp":"7380d685c09944cc759b5b903146b600","tree":"30e450504aa5ed6700cc0f4eb48bcce1980c240c","v":1,"via":"run"} Ci-Attestation: {"at":1793531881,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"f0b7074de900a65846c80abcb646317125a4cbc0489a78e0b7c1ca1e46a8c45f","lane":"cross","parents":["949785e0207bf04e288e1fc76e2116aecace8bb9"],"secs":62,"stamp":"cf690d83de640e9c845e6c866fa90c8d","tree":"30e450504aa5ed6700cc0f4eb48bcce1980c240c","v":1,"via":"run"} Ci-Attestation: {"at":1793531881,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"f0b7074de900a65846c80abcb646317125a4cbc0489a78e0b7c1ca1e46a8c45f","lane":"cross","parents":["949785e0207bf04e288e1fc76e2116aecace8bb9"],"secs":62,"stamp":"9183f50810d683e5cf7ef8d27473f24b","tree":"30e450504aa5ed6700cc0f4eb48bcce1980c240c","v":1,"via":"run"} Ci-Attestation: {"at":1793531881,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"f0b7074de900a65846c80abcb646317125a4cbc0489a78e0b7c1ca1e46a8c45f","lane":"cross","parents":["949785e0207bf04e288e1fc76e2116aecace8bb9"],"secs":62,"stamp":"5bb3198f9136790b0c321aad943536a2","tree":"30e450504aa5ed6700cc0f4eb48bcce1980c240c","v":1,"via":"run"} Ci-Attestation: {"at":1793531881,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"f0b7074de900a65846c80abcb646317125a4cbc0489a78e0b7c1ca1e46a8c45f","lane":"cross","parents":["949785e0207bf04e288e1fc76e2116aecace8bb9"],"secs":62,"stamp":"9deb2488d13d23bd97793a3d096bd7c0","tree":"30e450504aa5ed6700cc0f4eb48bcce1980c240c","v":1,"via":"run"} Ci-Attestation: {"at":1793531881,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"60e5f581f4ea74465cbc190da3bed264eb740c69582fa1f59096d60425fb7a65","lane":"tier2-linux","parents":["949785e0207bf04e288e1fc76e2116aecace8bb9"],"secs":258,"stamp":"798e2331ccbe78d2b69ec2cb31d92ede","tree":"30e450504aa5ed6700cc0f4eb48bcce1980c240c","v":1,"via":"run"}
vpacher
enabled auto-merge
November 1, 2026 11:31
zackees
approved these changes
Nov 1, 2026
zackees
left a comment
Member
There was a problem hiding this comment.
Coordinator review: correct. Taking &obs->audio only after the core check removes the UB without changing behaviour: the same rule order, and a refused call returns false. obs_get_audio_info2's early return matches obs_get_audio_info. Moving the two entries off the sanitizer known list is the right evidence: the asan lane now fails if they come back.
This was referenced Nov 1, 2026
alerque
pushed a commit
to alerque/obs-studio
that referenced
this pull request
Nov 2, 2026
…s-rust#3421) (obs-rust#3425) * test(cmocka): RED: test_media_cover_art_monitor holds the timing lock (obs-rust#3421) In the asan pass of obs-rust#3418 (run 41302253353), mp3_cover_restart_monitored got no packet on its first play within the test's window ("first play: 0 packets"), then 41 on the second; it passed in the 8 earlier asan runs. It plays real media in real time, so under the pool's load it can miss its window, like the four tests that already hold the lock. The harness test now lists it with the timing tests. Fails: test_timing_tests_hold_the_timing_lock. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(cmocka): GREEN: test_media_cover_art_monitor holds the timing lock (obs-rust#3421) RESOURCE_LOCK timing next to its TIMEOUT, so the sanitizer pool runs it alone after the other tests; in Tier 2 ctest only keeps it from overlapping the other timing tests. The test itself is unchanged. Harness tests: OK. Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=5762caaa8d23b0dae231fb856086fdd41c7d8a34 secs=336 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run,macos-native:n/a,windows-native:n/a Ci-Attestation: {"at":1793535327,"gate":"rust/all/fmt","host":"linux-x86_64","key":"10d11312ce8f0ba8026b23ebc401f1330d39cf312408c6e91169481ce28bdd5e","lane":"lint","parents":["41863dd8da7725aa0401de35f2f3538c3f835eaf"],"secs":88,"stamp":"bc3a83851cec2626f907e79d28bf6515","tree":"5762caaa8d23b0dae231fb856086fdd41c7d8a34","v":1,"via":"run"} Ci-Attestation: {"at":1793535327,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"10d11312ce8f0ba8026b23ebc401f1330d39cf312408c6e91169481ce28bdd5e","lane":"lint","parents":["41863dd8da7725aa0401de35f2f3538c3f835eaf"],"secs":88,"stamp":"f6cca8041d4f8164e24f71be1d7bbbdb","tree":"5762caaa8d23b0dae231fb856086fdd41c7d8a34","v":1,"via":"run"} Ci-Attestation: {"at":1793535327,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"144d002bc8e21901a3fd3e1063542f6e32cc3dec20169b28f319a3c734cff420","lane":"rust-test","parents":["41863dd8da7725aa0401de35f2f3538c3f835eaf"],"secs":136,"stamp":"cdf4e9c643abad232904b61c0f29dfc6","tree":"5762caaa8d23b0dae231fb856086fdd41c7d8a34","v":1,"via":"run"} Ci-Attestation: {"at":1793535327,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"c974981c4f833c0daf94f04131edd2ed8208df056d7adee2401d9afc889b6fad","lane":"cross","parents":["41863dd8da7725aa0401de35f2f3538c3f835eaf"],"secs":112,"stamp":"bc18fe56838813e9d76d09512bb4ea4a","tree":"5762caaa8d23b0dae231fb856086fdd41c7d8a34","v":1,"via":"run"} Ci-Attestation: {"at":1793535327,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"c974981c4f833c0daf94f04131edd2ed8208df056d7adee2401d9afc889b6fad","lane":"cross","parents":["41863dd8da7725aa0401de35f2f3538c3f835eaf"],"secs":112,"stamp":"aeaa5b7d4eb2763dffb440ff8b57ace2","tree":"5762caaa8d23b0dae231fb856086fdd41c7d8a34","v":1,"via":"run"} Ci-Attestation: {"at":1793535327,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"c974981c4f833c0daf94f04131edd2ed8208df056d7adee2401d9afc889b6fad","lane":"cross","parents":["41863dd8da7725aa0401de35f2f3538c3f835eaf"],"secs":112,"stamp":"3915545780f73e38850c29bb7cdf7f2c","tree":"5762caaa8d23b0dae231fb856086fdd41c7d8a34","v":1,"via":"run"} Ci-Attestation: {"at":1793535327,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"c974981c4f833c0daf94f04131edd2ed8208df056d7adee2401d9afc889b6fad","lane":"cross","parents":["41863dd8da7725aa0401de35f2f3538c3f835eaf"],"secs":112,"stamp":"a195e7db0014a32c3fcbf168993cdcd1","tree":"5762caaa8d23b0dae231fb856086fdd41c7d8a34","v":1,"via":"run"} Ci-Attestation: {"at":1793535327,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"3f073008d1613c4c64210f14a40a193f56e8502badf3847268e62749c70d4380","lane":"tier2-linux","parents":["41863dd8da7725aa0401de35f2f3538c3f835eaf"],"secs":266,"stamp":"d51453975fbdf3a6a91fb8a844dee3ed","tree":"5762caaa8d23b0dae231fb856086fdd41c7d8a34","v":1,"via":"run"} --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3363. Refs #3238, #3290.
Why
obs_reset_audio2()andobs_get_audio_info2()took&obs->audiobefore they checked for a core. Withobs == NULLthat address computation is undefined behaviour, even though neither function read through it before returning. UBSan reports it in every asan run (libobs/obs.c.h:1625and:1747on current master, "member access within null pointer of type 'struct obs_core'"), and the sanitizer known list carried both as kindbug.What changes
obs_reset_audio2()asks the core rule first and takes&obs->audioonly after it passed. The active-output rule follows as before.obs_get_audio_info2()returnsfalsewith no core first, asobs_get_audio_info()does (bug: libobs: level getters and texture checks crash with no core #2566).bugentries leave the known list (rust/tools/sanitize/triage.py).Both functions return what they returned before, and the rule calls run in the same order. Only trusted local callers reach this path, so it is a normal public bug.
Commits
Tests
The two tests (
test_core_setup_rules_steps,test_no_core_getters) through the sanitizer harness (sanitize.py, asan build, the harness's UBSan options) on a local build box:obs.c.h): one UBSan report each,libobs/obs.c.h:1625:25(obs_reset_audio2) andlibobs/obs.c.h:1747:25(obs_get_audio_info2): "member access within null pointer of type 'struct obs_core'". Both tests still exit 0: UBSan only reports.Tier 2 (unchanged C tests against libobs and libobs-c-reference) passes in the local gate. No Rust or C test changes; the existing tests cover the no-core path.
Checklist
master🤖 Generated with Claude Code