Skip to content

bug: libobs/frontend: the output protocol lookups crash on a NULL protocol #1827

Closed

Description

@rdoupe

obs_is_output_protocol_registered(NULL) crashes OBS in strcmp(), and so does obs_enum_output_types_with_protocol(NULL, ...), which asks it first. obs_enum_output_protocols(idx, NULL) writes through the NULL out pointer. A NULL protocol is not a registered protocol, so the check should return false and the enumeration should call nothing.

Upstream (obsproject/obs-studio master) has the same code. I found no upstream issue or PR for it.

Location

  • libobs/obs.c.h obs_is_output_protocol_registered() (3558-3566): strcmp(protocol, obs->data.protocols.array[i]) with no NULL check. It crashes as soon as any service output has registered a protocol, which obs-outputs (RTMP, RTMPS), obs-ffmpeg (SRT, RIST, HLS) and obs-webrtc (WHIP) always do.
  • libobs/obs-output.c.h obs_enum_output_types_with_protocol() (2762): calls obs_is_output_protocol_registered(protocol) first, so it crashes the same way.
  • libobs/obs.c.h obs_enum_output_protocols() (3568-3575): *protocol = ... with no check of the out pointer.
  • frontend/wizards/AutoConfigTestPage.cpp.hpp (220-233): the auto-configuration wizard passes obs_service_get_protocol(service) unchecked to can_use_output() (frontend/utility/BasicOutputHandler.hpp 149), which runs strcmp() on it, and then to obs_enum_output_types_with_protocol(). GetStreamOutputType() (BasicOutputHandler.cpp.hpp 170-176), the path that starts a real stream, already checks for NULL and logs "has no protocol set".

Class

Crash (NULL dereference, SIGSEGV) through the public API.

How it is reached

obs_service_get_protocol() returns NULL for a NULL service (obs_service_valid() fails), and a third-party service plugin can return NULL from get_protocol (registration only checks that the callback exists). Whatever then passes that protocol on crashes.

From the UI: in a normal install, no. The wizard only creates rtmp_common or rtmp_custom services, and neither returns NULL: rtmp_custom derives the protocol from the server URL and falls back to "RTMP", and rtmp_common returns its stored protocol or "RTMP" (an empty one when services.json cannot be read, which is not NULL). WHIP returns "WHIP". The wizard crashes only when that service cannot be created, for example when the rtmp-services plugin is missing or fails to load: then obs_service_create() returns NULL, obs_service_get_protocol(NULL) returns NULL, and the bandwidth test crashes in can_use_output() instead of showing "no output". I have not run that in the app; it follows from the code.

Otherwise only a plugin or script that passes NULL (its own service's protocol, or a NULL protocol directly) reaches it. Low.

Proposed fix and failing test

Fix (spec-following): obs_is_output_protocol_registered(NULL) returns false, so obs_enum_output_types_with_protocol(NULL, ...) returns before the match and calls nothing; obs_enum_output_protocols() with a NULL out pointer returns false. In the frontend, can_use_output() returns false for a NULL protocol, so the wizard reaches its existing "no output" failure. A registered protocol behaves as before.

RED test (cmocka, test_output_protocol_null): registers one service output with the protocol "TESTPROTO" and calls each lookup with NULL in a forked child. Today all 3 NULL cases crash (signal 11) on libobs with the C backend, the hybrid libobs and libobs-c-reference; the control, which checks that "TESTPROTO" is still found and enumerated, passes.

Activity

  1. rdoupe commented on Oct 22, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: #1827. Test and fix are ready; PR follows.

  2. added
    claimed
    on Oct 22, 2026
  3. added a commit that references this issue on Oct 22, 2026
    9f1dd90
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

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions