Skip to content

libobs: obs_output_set_mixer shifts by an unchecked index; obs_output_get_video_conversion dereferences NULL video #2127

Closed

Description

@rdoupe

Bugs

There are two unchecked inputs in libobs/obs-output.c.h. Both are reachable only from plugins and scripts, and upstream has the same code. They were found while porting the output video checks (#2117) and scoping round 6 of the Rust port (R6-5).

1. obs_output_set_mixer() shifts by an unchecked index

output->mixer_mask = (size_t)1 << mixer_idx is undefined for mixer_idx >= 64 (or 32 on 32-bit builds).

  • For 6 to 63 it selects a mixer that does not exist, and obs_output_get_mixer() then reports 0, which is not what was set.
  • No caller in the frontend or the bundled plugins passes such an index. obs_output_set_preferred_size2() already ignores an index out of range for its own index.

2. obs_output_get_video_conversion() dereferences NULL with no video and a scaled size

When the output has a scaled size but no video, the scaled branch reads info->format from video_output_get_info(NULL), which returns NULL.

  • An output has no video when obs_output_set_media() was given NULL video, or when it was created before video was reset.
  • The other branches handle a NULL video, as do video_output_get_width() and video_output_get_height().
  • DeckLink calls this function. Its UI calls it with only a NULL check of the result, and decklink-device-instance dereferences the result directly.

Plan

  1. RED: real-libobs tests.
    • obs_output_set_mixer() with 0 to 5, 6, 63, 64 and SIZE_MAX, checking the mask that obs_output_get_mixer() and obs_output_get_mixers() report.
    • obs_output_get_video_conversion() on an output with NULL video, with and without a scaled size.
    • Run under ASan/UBSan.
  2. GREEN:
    • obs_output_set_mixer() logs and ignores an index >= MAX_AUDIO_MIXES, as obs_output_set_preferred_size2() does.
    • obs_output_get_video_conversion() returns NULL when the output has a scaled size but no video, since there is nothing to convert from.
    • Every valid call keeps its current result.

Activity

  1. rdoupe commented on Oct 24, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: #2127.

  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