Repository navigation
obs-core: port canvas video info getter (#3950) - #3951
Conversation
d71aac5 to
436287b
Compare
Preserve the characterized graphics-present SIGSEGV with an explicit signal, without passing NULL to the C field accessor. Keep absent-graphics false returns and output storage unchanged. Add an independent Tier 1 NULL-accessor trap. RED: UBSan run 42431294485 job 128580754709.
|
Fixed the Rust FFI caller so a NULL canvas never reaches the mix field accessor. The unchanged characterization requires false with untouched output when graphics is absent, and SIGSEGV when graphics exists; the original emits no NULL error log. The wrapper now raises that signal explicitly instead of forming a field address from NULL. A Tier 1 callback trap checks that a missing canvas cannot reach the accessor, independently of the graphics short-circuit test. RED evidence is the UBSan finding in run 42431294485, job 128580754709. Six focused Rust cases, field discovery, native registration, all 157 native_build tests, obs-util's 914 tests and two doctests, and serial lint pass with exit zero. The unchanged C characterization also passes under the Nix ASan/UBSan build with UBSAN_OPTIONS=halt_on_error=1 and leak detection disabled. The initial leak-enabled run passed its assertions without UBSan findings but exited 8 for a 256-byte allocation in an unknown graphics-initialization module; that separate local LSan result is retained in /tmp/fix-3951-sanitize.log. No sanitizer suppression or C test was changed. Test cost over 25 reduced-parity Tier 1 module runs: longest 0.009 seconds, peak RSS 14,784 KiB, no test-owned threads. Review's graphics-short-circuit coverage finding was corrected. The fix is appended to the existing branch without rewriting its history. Hosted CI is left to the existing auto-merge handoff. |
Ports obs_canvas_get_video_info to obs-core while preserving the existing C API, return values and output storage. Rust owns lazy graphics/mix selection; private C adapters expose actual field addresses. The getter acquires no lock or reference. This follows #3946 and #3943, with discovered field adapters and an independent per-port native registration entry.
Fixes #3950, a native child of #444 with an accepted claim assigned to zackees. Queue hold: this PR is ready for the pool manager but must remain unarmed until #3937 has entered the merge queue. Auto-merge is off.
The live-library characterization establishes that absent graphics returns false without touching the output, even with NULL canvas or output. With graphics present, an absent mix returns false and preserves output bytes. A present mix returns true even when its video pointer is NULL, copies the tested storage bytes including padding, and preserves the borrowed graphics_module pointer. The original initialized-OBS and non-NULL canvas preconditions remain; a successful query needs writable output. An isolated child confirms SIGSEGV for NULL canvas with graphics present. Differential coverage also checks self-aliasing output and unchanged canvas, mix, core and token state.
The preserved sequence is C-only actual-library characterization a7bdabf, separate building verbatim extraction 41d58f4, Tier 1 RED cde680a, Rust GREEN 41f392d, and compiler-portable oracle TLS and formatting 436287b. RED originally pushed as d71aac5 and fails both safe-core tests at the intended stub with exit 101. Initializer formatting was folded into the characterization commit; its final blob is identical throughout extraction and the Rust swap. Range-diff confirms the implementation, extraction and RED commits are otherwise unchanged by rebase. The pushed head was checked against current master and replaced only the pinned earlier RED head.
Validation completed with successful exit codes:
Test cost: 25 reduced-parity debug runs per new module. Tier 1 measured below 0.01 seconds at timer resolution with peak RSS 10,816 KiB; layout/parity longest measured 0.01 seconds with peak RSS 16,260 KiB. Neither module starts its own threads; generated sizes and fixture allocations are bounded.
Evidence artifacts are under /home/niteris/.clud/tmp/tool-output/local-test-private/. Final serial gates, both-library replay and full lint are in local-test-vcPhp3.log; post-fix GCC/Clang checks are in local-test-KNywEA.log. Baseline, extraction, RED, initial GREEN and mutation are respectively local-test-fc6FH0.log, local-test-jw5wTa.log, local-test-YhBKo6.log, local-test-qflYRG.log and local-test-MP4ON8.log. Test-cost details and range-diff are in /tmp/port-canvas5-cost.json and /tmp/port-canvas5-range-diff.txt.
The optional channel getter remains in C because it delegates to the view getter's locked source-reference acquisition, a separate ownership characterization unit. Public headers, existing upstream C tests, WebSocket and workflows are unchanged. This behavior-preserving port needs no feature-ledger entry. Tier 4 is inapplicable; the full Tier 2 suite, full unittest entry point, native Windows/macOS runtime checks and local-gate attestation were not run. Hosted checks remain the merge gate and were not awaited under the pool assignment.