Repository navigation
Description
Unit
libobs/obs-module.c.h: the size rules of type registration (how much of the caller's obs_source_info, obs_output_info, obs_encoder_info or obs_service_info is copied, whether a field lies wholly within the caller's size, the zero-size and too-large gates of REGISTER_OBS_DEF, and the transition rule that ignores get_width/get_height), moved to libobs/obs-module-register-copy.c.h and ported to rust/obs-core as a new module module_register_copy, next to module_source_rules, module_type_rules and module_load_rules.
Phase and position
Phase 6 (libobs core), one more unit of the remaining obs-module.c.h C; tracking issue #4. It follows the fix for registrations that read version and caps past a short structure (#2841, #2844), which has landed.
Dependencies and existing tests
Uses obs_module_source_rules_size_supported (already Rust) for the too-large gate. The callback checks are already Rust (module_source_rules, module_type_rules), and test_register_short_info (#2844) registers short source and encoder infos. No test pins the copy length for every size, the in-size rule of each callback, the free on error, or the zero-size gate, so a characterization test (test_module_register_copy_steps) lands first, with fake info structures of each size, for all four types.
Scope
Rust takes over these decisions:
whole_fields_size: the copy ends at the size rounded down to a pointer, or at the end of a 32-bit field that starts there and lies wholly within the size (the pointer size and the 32-bit field offsets are passed in by C, so the core is right on 32-bit builds);HAS_VALandHANDLE_ERROR: a field counts only when it lies wholly within the size;REGISTER_OBS_DEF: a size of 0 is outsideobs_module_load, a size pastsizeofis too large, otherwise copy;obs_register_source_s: a transition'sget_widthandget_heightare warned about and ignored.
C keeps every offsetof/sizeof, every pointer read (each still under its in-size check), every memcpy, da_push_back, bstrdup, lookup, blog and the free_type_data call, each where it is today.
Plan
The standard six commits: move, characterization, Tier 1 RED, GREEN in a libobs.ported-module-register-copy group, Tier 3 parity, docs.
Notes
No SIMD, no per-OS code, no threads. Expected intentional differences: none on reachable inputs (offsets are offsetof constants; a field end past SIZE_MAX is unreachable).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 29, 2026
Claiming: #2860.
obs-module.c.hintolibobs/obs-module-register-copy.c.h, declared inlibobs/obs-module-register-copy.hwithoutEXPORT, with everyoffsetof, pointer read, copy, push and log left where it is (a scratch harness compares master's macros and copy-size functions with the moved ones over a logging stand-in).test_module_register_copy_steps, registering fake infos of every edge size for all four types against the real libobs.obs_core::module_register_copyTier 1 againsttodo!()stubs.libobs.ported-module-register-copy.sizeof + 8for each type at both pointer widths, plus proptests) with a mutation check.rust/README.md,naming.md, the crate description and module docs.The draft PR should be up within a few hours, once the RED commit exists.
libobs: Move the registration size rules
test: Characterize the registration size rules
obs-core: Test the module_register_copy port
obs-core: Port the registration size rules
obs-core: Check module_register_copy against the C
docs: Record the module_register_copy port
rdoupe commentedon Oct 29, 2026
Fixed by PR #2861 (merged, fe82f88): the size rules of type registration (how much of a plugin's source, output, encoder or service info is copied, whether a field lies wholly within the plugin's size, the zero-size and too-large checks, and the transition rule that ignores
get_width/get_height) now live inobs_core::module_register_copy, with the C moved tolibobs/obs-module-register-copy.c.h(grouplibobs.ported-module-register-copy). Tier 1, Tier 3 parity with a mutation check, and the ASan/UBSan characterization testtest_module_register_copy_stepsare in.What is left: C keeps every
offsetof()/sizeof(), pointer read,memcpy(),da_push_back(), lookup,blog()and thefree_type_datacall, as planned. The rest oflibobs/obs-module.c.h(module metadata loading, locale lookup, open/create/init bookkeeping, module enumeration) is still C.Follow-up issue: none filed yet for that rest; the next unit of it gets its own port issue.
obs-core: Port the registration size rules (obs-rust#2861)