Skip to content

bug: libobs: obs_reset_audio2 and obs_get_audio_info2 read through a null core (UBSan) #3363

Closed

Description

@vpacher

What happens

The asan pass (ASan + UBSan) reports undefined behaviour in two tests:

libobs/obs.c.h:1624:25: runtime error: member access within null pointer of type 'struct obs_core'
    #0 obs_reset_audio2            libobs/obs.c.h:1624
    #1 test_before_startup         test/cmocka/test_core_setup_rules_steps.c:323

libobs/obs.c.h:1747:25: runtime error: member access within null pointer of type 'struct obs_core'
    #0 obs_get_audio_info2         libobs/obs.c.h:1747
    #1 test_audio_info2_no_core    test/cmocka/test_no_core_getters.c:106

Both functions start with struct obs_core_audio *audio = &obs->audio; before they check for a core. With obs == NULL the address computation is already undefined behaviour, even when the function returns before it reads audio. It works in practice, but UBSan reports it every run.

What to do

Check obs (or call the existing no-core check) before taking &obs->audio. The tests already cover the no-core path. Only trusted local callers reach it, so this is a normal public bug.

The sanitizer harness's known list (rust/tools/sanitize/triage.py, #3290) has this as kind bug: the asan job does not count it, but fails once the test runs clean. So the fix PR also drops the entry.

Activity

  1. added
    bug
    P2
    size:S
    on Nov 1, 2026
  2. vpacher commented on Nov 1, 2026

    @vpacher
    MemberAuthor

    /ready

  3. added
    ready
    on Nov 1, 2026
  4. vpacher commented on Nov 1, 2026

    @vpacher
    MemberAuthor

    Claiming: check the core before &obs->audio

    Plan (one PR, after #3290):

    1. RED: the asan pass reports both UBSan findings (test_core_setup_rules_steps, test_no_core_getters); no new test needed.
    2. GREEN: obs_reset_audio2 and obs_get_audio_info2 return before they take &obs->audio when there is no core; the same for the Rust side if it mirrors it.
    3. Drop the two bug entries from the known list.

    First PR: after #3290 merges.

  5. vpacher commented on Nov 1, 2026

    @vpacher
    MemberAuthor

    Blocked: waiting on #3290

  6. added
    claim-blocked
    on Nov 1, 2026
  7. removed
    claim-blocked
    on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2bugreadysize:S

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions