Repository navigation
libobs: Ignore an out-of-range output mixer index and a conversion without video - #2142
Merged
Merged
Conversation
obs_output_set_mixer() stores (size_t)1 << mixer_idx for any index, so an index of 6 to 63 selects a mixer that does not exist (obs_output_get_mixer() then reports 0) and 64 or more shifts past the width of size_t. obs_output_get_video_conversion() reads the format from video_output_get_info(NULL) when a raw output has a scaled size but no video. test_output_input_checks runs both through the real libobs on core video (graphics suite, Linux with a display, skipped without one), with ASan and UBSan on the test (leak checks off: the GL driver keeps an allocation): - obs_output_set_mixer() with 0 to 5 gives that mixer and mask; - 6, 63, 64 and SIZE_MAX after mixer 2 and after mask 0x29 must leave the mask as it was, and a valid index still applies afterwards; - with video: no conversion without a scaled size or at the video's size, the video's format at a scaled size (both axes, or one), and a set conversion with its 0 axes filled from the scaled or video size; - without video (obs_output_set_media() with NULL video), in a forked child so a crash fails only that case: no conversion without a scaled size, and none with one; a set conversion still returns 0x0, the scaled size, or its own size. On origin/master the out-of-range mixer case fails 8 checks (6 and 63 set that bit, 64 sets mixer 0, SIZE_MAX sets bit 63) and the scaled case without video crashes with SIGSEGV, on the C backend, the hybrid and libobs-c-reference. The other four cases pass. Refs obs-rust#2127
…thout video obs_output_set_mixer() now logs a warning and ignores an index of MAX_AUDIO_MIXES (6) or more, leaving the mask as it was, as obs_output_set_preferred_size2() ignores an index out of range for its own index. Before, 6 to 63 selected a mixer that does not exist (and obs_output_get_mixer() then reported 0) and 64 or more shifted past the width of size_t. obs_output_get_video_conversion() now returns NULL when the output has a scaled size but no video (obs_output_set_media() with NULL video): with no video_output_info there is no format to convert from. Before, it read the format through a NULL pointer. The check sits in the C caller, where the info is read; obs_output_conversion_plan() and the Rust video_checks port still answer "scaled" from the sizes alone, so neither changes, and their docs now say that the caller returns NULL there. Every valid call keeps its result: indices 0 to 5, the conversion of an output with video, and a set conversion with or without video. No in-tree caller passes an index of 6 or more, and DeckLink, the only in-tree caller of the conversion, never sets a scaled size, so its set conversion is unchanged. The API reference documents both, test_output_video_checks_steps's comment on high mixer masks now names only obs_output_set_mixers(), and docs/features.md gets a line under fixed upstream bugs. Fixes obs-rust#2127
This was referenced Oct 24, 2026
5 of 7 tasks
vpacher
pushed a commit
to vpacher/obs-studio
that referenced
this pull request
Oct 26, 2026
…rust#2475) * libobs: Move the output encoder slot decisions Behaviour-neutral extraction before the Rust port. The decisions of the encoder slot setters and getters of obs-output.c move to libobs/obs-output-slots.c.h, as twelve functions on plain values declared in the new libobs/obs-output-slots.h without EXPORT (hidden, as -fvisibility=hidden keeps them): - get_first_video_encoder_index() and get_first_audio_encoder_index(): _first_video() and _first_audio(), the lowest occupied slot of an occupancy mask the caller builds (bit i: slot i is set), as can_begin_data_capture() already does; obs_output_audio() now calls get_first_audio_encoder_index() instead of its own copy of the loop; - obs_output_set_mixer(): _mixer_in_range() and _mixer_mask(); - obs_output_set_video_encoder2() and obs_output_set_audio_encoder(): _video_type_ok() and _audio_type_ok() (the type gate, also the slot choice of obs_output_remove_encoder_internal()), _video_index_ok() and _audio_index_ok() (multitrack: below the slot count, else 0 only); for video, _default_index() and _scaled_axis_set() (the encoder at index 0 takes the scaled size when both axes are set); - obs_output_get_video_encoder2(), obs_output_get_audio_encoder() and obs_output_set_preferred_size2(): _video_slot() and _audio_slot(), the bounds, and _default_index() for the raw size write. The plan sketched one slot_gate() returning refuse, same or replace. That would load active() before the type gate logs and returns, and read the slot before the index rule, so each step is its own function, asked at its own point, as obs-rust#2153 did. The log_flag_* calls stay in their order with their short circuit, active() is loaded where it was (after the type gate, before the index rule; after the range check in set_mixer()), info.type is read twice in obs_output_remove_encoder_internal() as the if/else-if did, and scaled_height only when scaled_width is set. C keeps obs_output_valid(), the log_flag_* checks, flag_encoded(), active(), every read of the output and the encoder, every pointer comparison (the slot already holding the encoder, the slots that hold it), every obs_encoder_get_ref() and obs_encoder_release() in their order, obs_encoder_add_output() and _remove_output(), destroy_caption_track() and create_caption_track() (a NULL test of the encoder), obs_encoder_set_scaled_size(), obs_encoder_audio() and every log. obs_output_set_mixers(), obs_output_remove_encoder() and obs_output_set_service() are unchanged: they decide nothing beyond the flag, active and NULL checks that stay, and their short-circuit order (log_flag_service(), then active(), then service->active) cannot move into one call without loading or reading ahead. Checked in a scratch harness (not committed). It compiles origin/master's flag helpers, active(), the two index helpers, obs_output_video(), obs_output_audio(), the mixer setters and getter, both remove functions, the four encoder setters and three getters, obs_output_set_service() and both preferred-size setters verbatim, and this branch's with the moved file, as C++, over a stand-in output whose fields (the flags, the slots, the caption tracks, the scaled size, the mixer mask, the service, the encoders' types, the services' active and output) log every read and write with the value. It logs every obs_output_valid(), active load, reference, release, output hookup, caption track, scaled size, obs_encoder_audio() and _video() and log line, in order, and each call's result. The stubs answer from one seeded stream in call order; another thread may flip active after any load of it, and a reference may fail. Reads with no write or call between them are compared as a sorted run. - Inputs: one to four calls of the eighteen entry points on one output, with any flag word (the seven flags and random high bits), every slot empty or holding one of six encoders (two video, two audio, types 2 and 9), indexes 0, 1, max - 1, max, max + 1, 2^32, SIZE_MAX and random, NULL encoders and NULL outputs, sizes 0, 1, 1280 and random, three services (one active, one owned by another output). - One expected difference, normalized on both sides: building the mask reads every slot, where the loop stopped at the first set one (plain pointers, no call, lock or write between). A scan of slots 0, 1, 2, ... in order is cut after its first set slot; every other read must match. - 2,600,000 runs (GCC and Clang -O2, 1,000,000 each; GCC -O0, 300,000; GCC -O0 with coverage, 100,000; ASan with UBSan under GCC -O0 and Clang -O2, 100,000 each) give equal events and equal state after each run: 34,198,187 events. - Every line and branch of origin/master's functions, this branch's and the moved file's is reached both ways (gcov). - 22 deliberately broken moves were planted. 21 fail it: each decision changed (the bit test inverted, slot 0 skipped, the last audio slot missed, the mask shifted by one, the range check, mask, type, index, default-index, scaled-size and bound rules each off by one, inverted or on the wrong kind), active() loaded before the type gate, scaled_height read with scaled_width 0, info.type read once in remove_encoder_internal(), the audio index rule dropped (it crashes), the raw size written at any index, and obs_output_audio() taking slot 0. The 22nd, _first_audio() scanning ten slots, is equivalent here: the caller's mask has no bit from 6 up. The characterization test pins the function itself. git blame on the moved lines shows upstream commits (6ec0b2d, 84e1f47, 6da26a3, b8a3ae1, 2036de8 and earlier) and one fork change, the mixer range check of obs-rust#2142. The constants (OBS_OUTPUT_MULTI_TRACK_AUDIO and _VIDEO, the two slot counts, MAX_AUDIO_MIXES and the two encoder types) are copied into the header, so it needs no core header; obs-output.c.h checks them with _Static_assert. The new file joins libobs.core-output, just before obs-output.c.h, with libobs.pch.h, which includes the new header; source-sets.json lists it. docs/rust-port/naming.md maps it to rust/obs-output. The exported symbol sets are unchanged (1766) on the C build, hybrid and c-ref; the twelve functions are local. Refs obs-rust#2467 * test: Characterize the output encoder slot steps test_output_slots_steps compiles libobs/obs-output-slots.c.h with ASan and UBSan, and calls only its functions through obs-output-slots.h. 16 cases: - the copied constants; - the first occupied video slot over every 10-bit mask under four high words, the first audio slot over every 6-bit mask likewise, the last slot of each, and no write of the index when none is set; bits past the slot count are ignored (slots 6 to 9 are video only); - set_mixer()'s range check at 5, 6 and the edge indexes, and the mask over every shift below the width of size_t; - the two type gates over eight types (the two real ones, 2, 3, 9, the negative and INT_MAX); - the two index rules over every low 8-bit flag word, with and without high bits, at 15 edge indexes (0, 1, 2, 5, 6, 7, 9, 10, 11, 31, 32, 63, 64, SIZE_MAX - 1, SIZE_MAX): OBS_OUTPUT_MULTI_TRACK is the audio flag, OBS_OUTPUT_MULTI_TRACK_VIDEO the video one, and each says nothing about the other kind; - the default index, the scaled-size axis test and the two bounds. The callers are also copied onto a stand-in output that records every warning, active load, reference, release, hookup, caption track and scaled size in order: obs_output_set_video_encoder2(), obs_output_set_audio_encoder(), the getters, obs_output_get_video_encoder(), obs_output_audio(), obs_output_set_mixer(), obs_output_remove_encoder_internal() and obs_output_set_preferred_size2(). They pin, end to end, for raw, encoded, video-only, audio-only and multitrack outputs: the flag warnings before anything else, the type warning before the active load, the active refusal (even for NULL), the index rules at 0, 1, max - 1, max and SIZE_MAX, the same encoder twice (nothing after the active load), the release of the old encoder before the reference to the new one, NULL clearing a slot and destroying its caption track, the preferred size at index 0 only and only with both axes set, the getters' bounds whatever the flags, the first encoder of obs_output_get_video_encoder() and obs_output_audio(), set_mixer() at MAX_AUDIO_MIXES - 1 and at it (the range warning before the active refusal), remove_encoder_internal() clearing every slot of the encoder's kind, and set_preferred_size2()'s raw write at index 0 and encoder size at any slot. Characterized, not endorsed: - an encoder whose reference fails (it is being destroyed) leaves the slot empty but still gets a caption track: the C tests the encoder it was passed, not the reference it got; - clearing video slot 0 of an output with a scaled size still sets the size, on the NULL slot, so obs_encoder_set_scaled_size() logs a NULL parameter; - remove_encoder_internal() looks for a video encoder only in the video slots (the setters refuse to put it anywhere else). obs_output_set_service(), obs_output_set_mixers() and obs_output_remove_encoder() moved nothing, so they are not copied here. It is in the native test graph, in name order, with the header as a watch input, and links libm off MSVC. No assert_in_range or fail_msg, so it builds with cmocka 1.x and 2.x, and it compares no values of two different enum types. The real-libobs tests test_multitrack_encoder_override, test_output_input_checks, test_service_encoder_settings, test_output_interleave_e2e, test_output_caption_codec, test_raw_output_video_reset and test_output_null_id cover the callers; test_multitrack_ladder the frontend's track layout. Refs obs-rust#2467 * obs-output: Add Tier 1 tests for output slots RED for the port of libobs/obs-output-slots.c.h to a new output_slots module of rust/obs-output, next to video_checks. The safe core is a stub (todo!()): SlotKind (Video, Audio) and its count(), first_slot(), mixer_in_range(), mixer_mask(), type_ok(), index_ok(), default_index(), scaled_axis_set() and slot_exists(), with the multitrack flags, the slot counts, the two encoder types and MAX_AUDIO_MIXES (from video_checks). The two C functions per kind (_first_video and _first_audio, ...) take the kind here. tests/output/output_slots.rs ports test_output_slots_steps 1:1: its 16 cases under the same names (steps_*), in the same order, with the same values and expectations, the characterized-not-endorsed cases included, the stand-in output written in Rust over the core. Edge cases (edge_*) check the core against models of the original C: the slot counts; the first slot over every 16-bit mask under four high words; the index rules over every low 16-bit flag word under four high words at indexes 0 to 11 and 15 edge values; the mixer mask past the width of usize (0, where the C's shift is undefined); the type gates over -1000 to 1000 and the i32 edges; a proptest of every decision over full-range values (4,096 cases); and a proptest of the stand-in over sequences of 1 to 11 calls (the setters, getters, obs_output_audio(), set_mixer(), remove_encoder_internal(), set_preferred_size2() and active flips) from any start, against the same stand-in with origin/master's expressions inline (4,096 cases). soldr cargo test -p obs-data --test obs-tests-core -- output::output_slots passes 1 of 23 (the constants) and fails 22 with "not yet implemented". Refs obs-rust#2467 * obs-output: Port the output encoder slot steps Ports libobs/obs-output-slots.c.h, the encoder slot rules and setter gates of obs-output.c, to the output_slots module of rust/obs-output. obs-output.c.h stays C around it: obs_output_valid(), the log_flag_* checks in their order, flag_encoded(), the active loads, every read of the output and the encoder, the occupancy masks, the pointer comparisons, every reference and release, the encoder hookups, the caption tracks, the scaled size and the logs. The hybrid libobs drops the C file and links the Rust shims in its place. Safe core (src/output_slots.rs): - SlotKind (Video, Audio): its count (10, 6), multitrack flag (OBS_OUTPUT_MULTI_TRACK_VIDEO, OBS_OUTPUT_MULTI_TRACK) and encoder type; - first_slot(): the lowest set bit of the mask below the count; - mixer_in_range(): below MAX_AUDIO_MIXES; mixer_mask(): bit idx; - type_ok(): the kind's encoder type; index_ok(): with the kind's multitrack flag below its count, else 0 only; slot_exists(): below the count, whatever the flags; - default_index(): 0; scaled_axis_set(): not 0. The module denies clippy's arithmetic, as, indexing, unwrap, expect, panic, todo, unimplemented and unreachable lints, keeps no state, takes no lock and does no arithmetic; its slot counts are asserted at compile time against the ones video_checks mirrors. Shims (src/ffi/output_slots.rs): the twelve functions keep the C signatures. The one pointer is the index the two first_* shims write, only when a slot is set, as the C did; no struct is mirrored. Intentional difference: mixer_mask() with an index at or past the width of size_t, where the C's shift is undefined, gives 0. The C asks only 0 to 5. C side: the file leaves libobs.core-output for its own group, libobs.ported-output-slots (LIBOBS_PORTED_SOURCES), whose PCH is only obs-output-slots.h; libobs.pch.h keeps the header for obs-output.c. The functions are not EXPORT, so the shims are hidden: rust-hidden.txt, the local: list of rust-exports.map and rust-unexports-macos.txt. libobs-rust already links the crate's ffi. ci/test_ported_sources.py checks the group on every host. test_output_slots_steps still compiles the C file into itself, unchanged. It has no _rust variant, as for test_output_raw_audio_steps: the shims' archive member also holds the rest of obs-output, which needs libobs's hidden seams and obs-util, so it does not link on its own. Its tests.d file says so. soldr cargo test -p obs-data --test obs-tests-core -- output::output_slots passes 23 of 23. Refs obs-rust#2467 * obs-output: Check the output slots port against C Tier 3 for the output_slots port. The oracle (rust/obs-c-oracle/oracle/output_slots.c) compiles the unchanged libobs/obs-output-slots.c.h with its twelve functions renamed to oracle_*, plus its seven constants, bound in src/output_slots.rs. Nothing in it divides or calls out. tests/output/output_slots_parity.rs compares the oracle, the shims and the core exactly, all three sides: - the seven constants; - the first slot of each kind over every 16-bit mask under 16 high words and a stride through all u32, with whether the index was written (it starts as a sentinel); - the mixer range over 0 to 1023 and the edge indexes, the mask at every shift below the width of usize; - the type gates over -100,000 to 100,000 and the i32 edges; - the index rules over every low 16-bit flag word under four high words at indexes 0 to 11 and 15 edge values; - the default index and the bounds over 0 to 1023 and the edges, the scaled-size axis over 0 to 1023 and a stride through all u32; - the callers (both encoder setters, the getters, obs_output_get_video_encoder(), obs_output_audio(), set_mixer(), remove_encoder_internal() and set_preferred_size2(), as the C test's stand-in output) on the oracle and on the shims: every one- and two-call sequence of 14 calls from 64 starts (every combination of the video, audio, encoded and both multitrack flags, empty or with encoders, captions and a scaled size; 13,440 sequences), and each call from those starts made active, comparing every warning, active load, reference, hookup, caption track, scaled size and result; - proptests (20,000 cases each) of every decision over full-range values and of the callers over sequences of up to 16 calls from any start. The oracle is called for mixer_mask() only below the width of usize, where the C's shift is defined; that excludes exactly the intentional difference. Otherwise no input is excluded. Mutation check (once, not committed): 23 mutants, 16 in the core and 7 in the shims. mutant Tier 1 Tier 3 first_slot: bit test inverted 6 4 first_slot: slot 0 skipped 5 4 count: ten audio slots 10 6 bit_set: the next bit 6 4 mixer_in_range: <= 4 4 mixer_mask: the next bit 4 4 mixer_mask: all bits past the width 2 0 type_ok: inverted 10 4 encoder_type: kinds swapped 9 3 multi_track_flag: kinds swapped 8 4 index_ok: multitrack <= 6 4 index_ok: single track takes 1 6 3 index_ok: flag test inverted 8 4 default_index: <= 1 5 3 scaled_axis_set: > 1 1 1 slot_exists: <= 5 4 shim first_video: audio slots 0 4 shim first: index written when none 0 2 shim video_type_ok: audio 0 3 shim audio_index_ok: video 0 4 shim video_slot: audio 0 4 shim mixer_mask: the next index 0 4 shim scaled_axis_set: inverted 0 4 (failing tests per tier.) Tier 1 kills all 16 core mutants, Tier 3 22 of 23. Its survivor is the intentional difference: the mask past the width of usize, where the oracle is not called; Tier 1 pins it. soldr cargo test -p obs-data --test obs-tests-core -- output::output_slots passes 32 of 32 (23 Tier 1, 9 Tier 3). Refs obs-rust#2467 * docs: Record the output encoder slot port rust/README.md gets the row for libobs/obs-output-slots.c.h (obs-output::output_slots): what moved, what stays C and why, the one read that changed (the occupancy mask reads every slot, as can_begin_data_capture() already does), the characterized-not-endorsed behaviours (a caption track for a slot whose reference failed, the scaled size asked of a cleared slot), the one intentional difference and the tests that cover it; the obs-output crate row, its Cargo description and lib.rs name the new module. docs/rust-port/naming.md already maps the file to rust/obs-output (the move commit). rust/obs-c-oracle/benches/port_comparison/output_slots.rs, in the sorted module list, runs 1024 rounds of every decision the setters, getters and obs_output_set_mixer() ask (both first-slot scans, the type, index, default-index, scaled-size, bound and mixer rules), on the shims and on the oracle, and checks both checksums match. Release, x86_64 Linux, GCC, a loaded host, median: Rust 14.81 us, C 15.29 us (0.97x). The port changes nothing a user can see, so docs/features.md has no line. Fixes obs-rust#2467
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2127
What and why
Two unchecked inputs in
libobs/obs-output.c.h, both reachable only from plugins and scripts (upstream has the same code):obs_output_set_mixer()stored(size_t)1 << mixer_idxfor any index. For 6 to 63 that selects a mixer that does not exist, andobs_output_get_mixer()then reports 0. For 64 or more the shift is undefined; on x86-64 64 wraps to mixer 0 andSIZE_MAXsets bit 63. It now logs a warning and ignores an index ofMAX_AUDIO_MIXES(6) or more, so the mask stays as it was.obs_output_set_preferred_size2()ignores an out-of-range index of its own in the same way; it does so silently, but this one warns, because a wrong mixer is otherwise invisible. The check comes after the validity and raw-output checks and before the active check.obs_output_get_video_conversion()readinfo->formatfromvideo_output_get_info(NULL)when the output had a scaled size but no video. That happens afterobs_output_set_media()with NULL video, or when the output was created before video was reset. It now returns NULL in that case, since there is no format to convert from. The other branches already treated a NULL video as 0x0.Where the check sits. Since #2117,
obs_output_conversion_plan()(libobs/obs-output-video-checks.c.h) and its Rust portobs-output::video_checks::video_conversiondecide the plan from sizes alone. They never see thevideo_output_info. The NULL check therefore goes in the C caller, whereinfois read, and the plan, its Rust port and the parity tests stay as they are. One comment line was added on each side: on the C plan declaration inobs-output-video-checks.h, and onConversion::Scaledinrust/obs-output/src/video_checks.rs. Each says that the caller returns NULL there.Every valid call keeps its result: mixer indices 0 to 5; the conversion of an output with video (none, scaled, or set); and a set conversion with or without video.
Also in this PR:
docs/sphinx/reference-outputs.rstdocuments both behaviours.first_mixer_high_bits_onlyintest_output_video_checks_steps.cnow names onlyobs_output_set_mixers()as a way to get a mask with high bits only. Its expectations are unchanged.docs/features.mdhas a line under fixed upstream bugs (Stability).History (
git log -L).obs_output_set_mixer()has only upstream history (84e1f47, f07ce85, ceb675f, b8a3ae1, 645e31f); the shift has been unchecked since mixers were added.obs_output_get_video_conversion()goes back to upstream (6da26a3 … fb57eff, a1fbf10) and then to #2117 (81281c3), which moved the size choice into the plan and kept theinforead here. The NULL read is older than #2117: the upstream code did the same.Callers (read-only survey):
obs_output_set_mixer(): no in-tree caller. The frontend usesobs_output_set_mixers()(AdvancedOutput,SimpleOutput) and the bundled plugins don't call it. Scripts can reach it through the obs.h bindings.obs_output_get_video_conversion():libobsobs_output_begin_data_capture()→start_raw_video(). This only runs aftercan_begin_data_capture()has required video, so its output has video.decklink_output_create()always sets a conversion withobs_output_set_video_conversion()when it finds the device, and DeckLink never sets a preferred size. So DeckLink outputs never reach the scaled branch, and this PR changes nothing for them.decklink-ui-main.cpp.hppoutput_start()/preview_output_start()NULL-check the result and release the output when it is NULL.decklink_ui_render) dereferences it without a check. It only runs for an output whose start found a conversion, and that conversion stays set.decklink-device-instance.cpp.hppStartOutput()dereferences it without a check, but only when the program video is HDR (source_hdr && ...->colorspace). See below.Nonefor NULL, as they already do with no conversion.Seen while checking, not changed here:
DeckLinkDeviceInstance::StartOutput()dereferencesobs_output_get_video_conversion()without a NULL check, and only on HDR video. The result is NULL for adecklink_outputwhose device was not found when it was created (no conversion set) but is found when it starts, for example a card connected in between, if a plugin or script creates the output. This is pre-existing and not affected by this fix: DeckLink never reaches the scaled branch. The DeckLink UI's own outputs are safe, because the UI releases an output that has no conversion.decklink_output_create()dereferencesdevice->FindOutputMode(modeID)without a NULL check when the saved mode ID is not one the device has. Also pre-existing.RED → GREEN
RED commit:
e2e0c4f97test: Check an output's mixer index and conversion without video. It addstest_output_input_checks, a new real-libobs cmocka test. There was no natural existing home.test_output_video_checks_stepscompiles only the pure helpers and has noobs_output_t, andtest_raw_output_video_resetis built around pinning freedvideo_tmemory across resets. The new test is intest/cmocka/build/test-graph.json, in the graphics suite (Linux with a display, exit 77 without one), withaddress,undefinedon the test. Leak checks are off (ASAN_OPTIONS=detect_leaks=0): the GL stack keeps one 128-byte allocation from a module it unloads before exit, and it does so on every run, passing or failing, as Qt and fontconfig do intest_properties_dialog_refresh. The six cases:set_mixer_valid_indices: indices 0 to 5 give that mixer and mask;set_mixer_out_of_range_keeps_mask: 6, 63, 64 andSIZE_MAX, after mixer 2 and after mask0x29, must leave the mask; mixer 5 still applies afterwards;conversion_with_video: no conversion when unscaled or at the video's size; the video's format at 32x24 and at one scaled axis; a set conversion of 0x0 filled from the video (64x48) or the scaled size (32x24); a set 16x8 kept;conversion_no_video_unscaled,conversion_no_video_scaled,conversion_no_video_set: withobs_output_set_media(output, NULL, audio), in a forked child so a crash fails only that case. They expect no conversion unscaled or scaled. A set conversion gives I420 0x0, the scaled 32x24, or its own 16x8.On
e2e0c4f97(rebased on6bae29730; the same result as before the rebase on1cddf78da), it fails 2 of 6 on the C backend, the hybrid and libobs-c-reference alike:set_mixer_out_of_range_keeps_maskfails 8 checks: 6 → mask0x40; 63 andSIZE_MAX→0x8000000000000000; 64 →0x1; each after mixer 2 and after mask0x29, withobs_output_get_mixer()reporting 0 each time;conversion_no_video_scaled: "obs_output_get_video_conversion() crashed with signal 11".GREEN:
896af56c7libobs: Ignore an out-of-range output mixer index and a conversion without video.test_output_input_checkspasses 6/6 on all three libraries and logs the eight "Ignoring mixer index" warnings.896af56c7, against the C libobs, the hybrid and libobs-c-reference (ninja libobs-c-referencerun first, itslibobs.so.30rebuilt at the same time as the hybrid's): 12/12 on each. The 12 are the new test and every existing output test that touches mixers, the scaled size or the video conversion:test_output_video_checks_steps(there is no_rustvariant; its tests.d file explains why),test_raw_output_video_reset,test_scaled_mix_alpha,test_encoding_lag_rescale,test_ffmpeg_output_stop,test_ffmpeg_output_alpha,test_ffmpeg_output_drain,test_texture_encoder_raw_format,test_output_start_twice,test_output_failed_start_encodersandtest_output_null_id.896af56c7, with a privateXvfb -noreset,dbus-run-session, a fresh HOME,ulimit -c 0and TMPDIR unset,-j8:test_deinterlace_2x_field_order_50i_into_50(discard_2x_bottom_first_50i_into_50: one field skipped under-j8load). This is the known timing sensitivity in test_deinterlace_2x_field_order is timing-sensitive (yadif 2x 60i into 60): startup underrun and load-induced hold #456. It passed 3/3 when re-run alone. This PR does not touch deinterlacing.1cddf78da: C 438/438, and hybrid 450/451 with the same flake in another case of the same test (_50i_into_30), which also passed 3/3 alone.896af56c7, from the repo root:uv run ci/local_gate.py --test-diff origin/master: ok. It ran the workspace: 3290 tests, 3290 passed, 4 skipped.--lane lint: ok. Before the rebase it caught clang-format line wrapping in the new test, which was folded into the RED commit.--lane cross: ok.Real app (UI, protocol output or logging changes): no app run. The only new log line is the out-of-range warning, which no in-tree caller can trigger, and the test shows it.
Checklist
master(or the description starts with a Stacked: note)docs/features.mdis added or updated (not applicable: no user-visible change)-W..., ratchets): built with scripting ON (PR CI builds no OBS app: rungh workflow run ci.yml --ref <branch>for the full builds) and cross-checked with clang and MSVC