Skip to content

libobs: obs_set_video_levels accepts 0, negative and NaN white levels #2209

Closed

Description

@rdoupe

Bug

obs_set_video_levels() (libobs/obs.c.h) stores both levels without checking them:

video->sdr_white_level = sdr_white_level;
video->hdr_nominal_peak_level = hdr_nominal_peak_level;

The frontend passes config_get_uint(..., "SdrWhiteLevel") and "HdrNominalPeakLevel" from the profile. A hand-edited or imported profile can give 0, or a huge value when it holds a negative number. Plugins and scripts can pass anything, including NaN.

The draw paths divide by the SDR white level (80.0f / obs_get_video_sdr_white_level() in the async and source draws, and in the deinterlace draw). A level of 0 makes the multiplier +inf, so scRGB sources draw solid white or black on SDR canvases. A NaN level spreads into every pixel.

Upstream has the same code. This was found while scoping round 7 of the Rust port (R7-4).

Plan

  1. RED: a real-libobs test that calls obs_set_video_levels() with 0, a negative value, NaN, ±inf and a huge value, for each level. Check what obs_get_video_sdr_white_level() and obs_get_video_hdr_nominal_peak_level() return, and that a valid pair is stored exactly.
  2. GREEN: ignore a level that isn't finite and positive, keeping the previous value (300 and 1000 by default), with a warning. Each level is checked on its own, so a valid value in a bad pair is still stored. Every valid level behaves as before.

Activity

  1. rdoupe commented on Oct 24, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: #2209.

  2. added
    claimed
    on Oct 24, 2026
  3. moved this from In progress to Done in obs-rust Multiviewon Oct 25, 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