Skip to content

libobs: Creating a raw output before obs_reset_video crashes in obs_get_video #2237

Closed

Description

@rdoupe

Bug

Creating a raw output (one without OBS_OUTPUT_ENCODED) after obs_startup() but before obs_reset_video() crashes with SIGSEGV.

  • obs_output_create() (libobs/obs-output.c.h:233) calls obs_get_video() for every non-encoded output.
  • obs_get_video() (libobs/obs.c.h:1806) returns obs->data.main_canvas->mix->video without checking for NULL. The main canvas's mix is NULL until video is reset.

Backtrace: obs_get_video() (obs.c.h:1806) ← obs_output_create() (obs-output.c.h:233) ← caller.

Only a caller that creates an output before setting up video can hit this: a plugin, a script or a headless tool. The frontend always resets video first. Upstream has the same code.

Found while writing the test for #2203.

Reproduce

  1. Call obs_startup("en-US", NULL, NULL).
  2. Register an output type with get_name, create, destroy, start and stop, and flags = 0.
  3. Call obs_output_create(id, "n", NULL, NULL). It crashes immediately.

Plan

  1. RED: a cmocka test that creates a raw output before obs_reset_video(), in a forked child. It should get an output with no video, or NULL, instead of a crash.
  2. GREEN: obs_get_video() returns NULL when the main canvas has no mix yet, matching how the other video getters behave before video is reset. Then check that obs_output_create() and the output start path already handle a NULL video (libobs: obs_output_set_mixer shifts by an unchecked index; obs_output_get_video_conversion dereferences NULL video #2127 added the conversion check). Start must fail cleanly with no video.

Every output created after video setup is unchanged.

Activity

  1. rdoupe commented on Oct 24, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: #2237.

  2. added
    claimed
    on Oct 24, 2026
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