Skip to content

bug: libobs/frontend: Settings crashes on a NULL output id when the stream protocol has no output (upstream #12843) #217

Closed

Description

@rdoupe

Upstream OBS bug, reported by HanabishiRecca in obsproject/obs-studio#12843 (their issue includes a NULL guard for find_output). Code unchanged in this fork.

Location

  • libobs/obs-output.c:122-130: find_output() runs strcmp on the id with no NULL check. Every id-keyed getter reaches it (obs_get_output_flags, obs_output_get_display_name, obs_output_defaults, obs_get_output_properties, obs_get_output_supported_video_codecs, obs_get_output_supported_audio_codecs).
  • frontend/settings/OBSBasicSettings_Stream.cpp:1545, 1580, 1749, 1757: const char *output; is declared uninitialised, then filled by obs_enum_output_types_with_protocol(), whose callback never runs when no output supports the protocol. The pointer is then passed to the codec getters above.

Class

Uninitialised pointer / NULL dereference (crash).

How it is reached

Opening Settings when the stream service's protocol has no output (the reporter's case: no outputs available). Reproduced headlessly with a profile whose stream protocol has no registered output: SIGSEGV in find_output (id=0x0) ← obs_get_output_supported_audio_codecs ← OBSBasicSettings::ResetEncoders ← LoadOutputSettings ← the OBSBasicSettings constructor, the same stack as the report.

Proposed fix and failing test

Fix: find_output() returns NULL for a NULL id (as the getters already handle unknown ids), and the four frontend pointers start as nullptr. Both are needed: the frontend change alone still passes NULL into libobs, and the libobs guard alone leaves undefined behaviour in the frontend.

RED test (cmocka, test_output_null_id): each of the six getters called with NULL in a forked child crashes with signal 11 today (6 of 7 fail; a registered-id control passes). With the fix all 7 pass, and the headless repro opens Settings without crashing.

Activity

  1. rdoupe commented on Oct 11, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: this issue.

    1. RED: test_output_null_id (6 of 7 crash today).
    2. GREEN: NULL guard in find_output() and initialise the four frontend output pointers.
      PR within the hour.
  2. added 3 commits that reference this issue on Oct 11, 2026
    21c02f2
    0a80051
    646a19a
  3. rdoupe commented on Oct 11, 2026

    @rdoupe
    CollaboratorAuthor

    @HanabishiRecca you reported this in obsproject/obs-studio#12843, so a heads-up: it's fixed here in obs-rust by #219, with a regression test. The libobs half is the NULL guard in find_output() you suggested.

    Cause: the stream settings page declares const char *output; uninitialised and fills it from obs_enum_output_types_with_protocol(). When no output supports the protocol, the callback never runs and the garbage/NULL pointer reaches find_output()'s strcmp. Besides your guard, the four frontend pointers now start as nullptr, so the frontend no longer passes undefined values into libobs. A headless repro with a stream protocol that has no registered output crashed with your stack before and opens Settings after.

    Workaround on stock OBS: make sure the output plugin for your stream protocol (obs-outputs for RTMP) loads, so Settings has an output to find.

    obs-rust is an AI-assisted fork of OBS; on Arch it's obs-studio-rust-git in the AUR.

    If you get a chance to try it, a reply here on whether Settings opens in your setup would really help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions