Skip to content

CI trigger: fix/79-oracle-osfopen-utf8 (upstream PR check) — do not merge - #4

Merged
chriscoveries merged 24 commits into
masterfrom
fix/79-oracle-osfopen-utf8
Oct 10, 2026
Merged

chriscoveries merged 24 commits into
masterfrom
fix/79-oracle-osfopen-utf8

Conversation

@chriscoveries

Copy link
Copy Markdown
Owner

Fork-internal PR to run pr-pull.yaml CI against fix/79-oracle-osfopen-utf8. Not for merging.

b7216309-jpg and others added 17 commits October 10, 2026 02:54
Pins the exported functions of graphics/vec4.c before the Rust port:
vec4_from_vec3 sets w to 1 whatever the vec3 w lane holds, and
vec4_transform is a row vector times the matrix, including when dst and
v are the same vector.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Tier 1, Tier 2 layout and Tier 3 parity tests for libobs/graphics/vec4.c
against a todo!() core.

The C files of the graphics math cluster (vec3, vec4, matrix3, matrix4,
quat, plane, bounds, axisang, math-extra) call each other, so the oracle
compiles all of them, renamed to oracle_* by graphics_math_names.h. Later
ports of those files reuse it.

libobs/util/sse-intrin.h takes SSE from SIMDe outside MSVC, and the Rust
test jobs do not install SIMDe. The oracle gets a stand-in
<simde/x86/sse2.h>: the native SSE header on x86, and elsewhere scalar
versions of the 15 intrinsics the math headers use, lane by lane as SSE
defines them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
vec4_from_vec3 and vec4_transform move to Rust. With ENABLE_RUST_LIBOBS=ON
libobs builds without graphics/vec4.c, and vec3_transform and the other C
callers link the Rust shims.

Vec4::dot adds the four products as (w + y) + (z + x), the order the SSE
shuffles in vec4_dot produce, so transform results are bit-identical to
C. No intentional differences.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	rust/README.md
#	rust/obs-c-oracle/build.rs
Pins the exported functions of graphics/vec3.c before the Rust port:
plane distance, rotation by a matrix3's axes, the 3x4 transform that
subtracts the translation first, the matrix4 point transform, both
mirrors, and vec3_rand repeating after the same srand seed. Every
result has w cleared.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Tier 1, Tier 2 layout (vec3, plane, matrix3) and Tier 3 parity tests
for libobs/graphics/vec3.c against a todo!() core.

vec3_rand calls libobs rand_float, which stays C in math-extra.c, so
the Rust shim calls it too. Test binaries have no libobs, so the oracle
hosts an unrenamed rand_float backed by its math-extra copy; the parity
test seeds the C library's rand the same way for both sides.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
vec3_from_vec4, vec3_plane_dist, vec3_rotate, vec3_transform,
vec3_transform3x4, vec3_mirror, vec3_mirrorv and vec3_rand move to
Rust. With ENABLE_RUST_LIBOBS=ON libobs builds without graphics/vec3.c.

struct vec3 has an SSE w lane, and vec3_dot multiplies it, so a
caller's nonzero or NaN w changes the result. Vec3 keeps w, and dot
adds the products as (w + y) + (z + x), the SSE order. No intentional
differences.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	rust/README.md
#	rust/obs-c-oracle/src/lib.rs
dstr_to_wcs, dstr_from_wcs, dstr_from_mbs and dstr_to_mbs run through
the oracle's util/dstr.c, whose conversion helpers are stubs returning
0. Against those stubs, three of these four tests fail: every
conversion yields NULL or nothing, where libobs converts. The empty
dstr case passes, since NULL is libobs's answer too.

Refs #84

Co-Authored-By: Claude Opus 5.5 <[email protected]>
os_utf8_to_wcs_ptr, os_mbs_to_utf8_ptr and wchar_to_utf8 were stubs
that returned 0 for every input, so the oracle's dstr_to_wcs,
dstr_from_mbs and dstr_from_wcs failed where libobs converts. A port
checked against them would have copied that failure (#79 was the same
problem with os_fopen).

The oracle now compiles the real util/utf8.c, which converts with
MultiByteToWideChar on Windows and in portable C elsewhere, as libobs
does. oracle/platform_conv_host.c copies the platform.c conversions
dstr.c reaches verbatim: os_{mbs,utf8}_to_wcs, os_wcs_to_utf8, and
their _ptr forms plus os_mbs_to_utf8_ptr. It is a new file, so the
os_fopen changes in #82 do not conflict.

Fixes #84

Co-Authored-By: Claude Opus 5.5 <[email protected]>
rust/obs-c-oracle: Replace the dstr conversion stubs with libobs code
quat_set(&q, 1, 2, 3, 4) must give x=1, y=2, z=3, w=4, and
quat_set(&q, 0, 0, 0, 1) must equal quat_identity. Today it stores
x=4, y=3, z=2, w=1 (checked with MSVC against graphics/quat.h), so both
cases fail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
quat_set passed x, y, z, w to _mm_set_ps, which takes its arguments
high lane first, so the quaternion was stored reversed: x got w, y got
z, z got y and w got x. vec3_set and vec4_set already pass the lanes
high first. Nothing in the tree calls quat_set, but it is public API
and the Lua and Python scripting bindings expose quat.h.

Also fixes the quat_set entry in the docs, which listed only x and y
in the signature and named the z parameter y.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
libobs/graphics: Fix component order in quat_set
b7216309-jpg and others added 6 commits October 10, 2026 16:47
Pins obs-av1.c on well-formed streams:
- keyframes come from the first frame (header) OBU: show_existing_frame
  is never a key frame, frame_type 0 is;
- sequence header and metadata OBUs are copied to the header while
  every OBU stays in the packet;
- metadata_obu and the ITU-T T.35 wrapper build the OBU byte for byte,
  with a two-byte leb128 size above 127.

Adds regressions that fail on the current code:
- an OBU whose size field claims more than the buffer holds is copied
  past the end;
- a 5-byte leb128 size is shifted in int, which overflows;
- without a size field, an OBU with an extension byte is sized
  size - 1, one byte past the end;
- a lone header announcing an extension byte and a size field
  underflows size - obu_start.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
parse_obu_header trusted the stream:
- leb128 shifted each byte as an int, which overflows (undefined
  behavior) from the 5th byte on and sign-extends into the 64-bit size;
- an OBU's size was never checked against what was left, so
  obs_extract_av1_headers copied past the end of the packet;
- without a size field the size was size - 1, one byte too many when
  an extension byte is present (AV1 spec 5.3.1: sz - 1 -
  obu_extension_flag);
- a 1-byte OBU announcing an extension byte made size - obu_start
  underflow.

Now the shift is done in 64 bits, the header and extension byte are
capped at the buffer, the no-size-field case follows the spec, and the
size is cut to what is left. Well-formed streams parse as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
libobs: Keep AV1 OBU parsing inside the buffer
rust: Port graphics/vec3.c to obs-graphics
The Windows oracle stub converted paths with MB_ERR_INVALID_CHARS and
refused non-UTF-8 paths. libobs os_fopen goes through os_utf8_to_wcs_ptr
and utf8_to_wchar (flags 0), substituting U+FFFD and attempting the
mangled path. The oracle now calls the real conversion from
platform_conv_host.c + util/utf8.c (#85) and mirrors platform.c /
platform-windows.c for os_fopen, os_unlink, os_rename, os_safe_replace.

non_utf8_filename_matches_oracle now runs on Windows. It is RED there:
the oracle (like libobs) creates the U+FFFD-substituted file while the
Rust core declines non-UTF-8 paths upfront.

Refs #79

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Local-Gate: v1 tree=31e492ec99b018c677d02a96412f6d1c30e372e4 secs=38 lanes=lint:run,rust-test:run,tier2-linux:run
Ci-Attestation: {"at":1791649374,"gate":"rust/all/fmt","host":"linux-x86_64","key":"8aa5b28fb4afc2904702ec9b93680280b753f6c5d3f5cdf9effe3ffd15292846","lane":"lint","parents":["11d60f0cc8ee82d2a15efcc6efd80acc2d6b60f5"],"secs":11,"stamp":"8823f1f258cdcf1fdcec7e217876da1d","tree":"31e492ec99b018c677d02a96412f6d1c30e372e4","v":1,"via":"run"}
Ci-Attestation: {"at":1791649374,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"8aa5b28fb4afc2904702ec9b93680280b753f6c5d3f5cdf9effe3ffd15292846","lane":"lint","parents":["11d60f0cc8ee82d2a15efcc6efd80acc2d6b60f5"],"secs":11,"stamp":"2301a2226c55ad88c2b2bf6daca3a0a2","tree":"31e492ec99b018c677d02a96412f6d1c30e372e4","v":1,"via":"run"}
Ci-Attestation: {"at":1791649374,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"a3028f92add1b468c524cfc3cbe728adccd979c6df36af8d02cd047f81d3e69a","lane":"rust-test","parents":["11d60f0cc8ee82d2a15efcc6efd80acc2d6b60f5"],"secs":7,"stamp":"7c38fb4c292d939a1c5b2540ba90a6a4","tree":"31e492ec99b018c677d02a96412f6d1c30e372e4","v":1,"via":"run"}
Ci-Attestation: {"at":1791649374,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"cfe447ea48335660f96f390d752b3f752a654527c89a84ac9893cc731df6bae4","lane":"tier2-linux","parents":["11d60f0cc8ee82d2a15efcc6efd80acc2d6b60f5"],"secs":20,"stamp":"b493db31b8c6182780e30f331ee6387e","tree":"31e492ec99b018c677d02a96412f6d1c30e372e4","v":1,"via":"run"}
@zackees
zackees force-pushed the fix/79-oracle-osfopen-utf8 branch from 4883153 to 34935e7 Compare October 10, 2026 16:23
libobs os_fopen converts paths with utf8_to_wchar (flags 0), replacing
invalid UTF-8 with U+FFFD and attempting the result. The file-serializer
core refused such paths instead. Convert lossily so it creates/opens the
same name libobs does.

Fixes #79

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Local-Gate: v1 tree=e6c61c5ab7e831ece2d2d39c86f109b641efb01d secs=34 lanes=lint:reused@0b45dce8f2ad,rust-test:reused@50e370c57f16,tier2-linux:run
Ci-Attestation: {"at":1791650057,"gate":"rust/all/fmt","host":"linux-x86_64","key":"0b45dce8f2ad56764f5cfc0fc93f28378e0862de9386c92452ee212115a471e3","lane":"lint","parents":["34935e784e2e8e24e8a88cbf0aa53f4bcc3e2db4"],"secs":null,"stamp":"b1ad98269347bc4c05af6847fa683e6c","tree":"e6c61c5ab7e831ece2d2d39c86f109b641efb01d","v":1,"via":"reused"}
Ci-Attestation: {"at":1791650057,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"0b45dce8f2ad56764f5cfc0fc93f28378e0862de9386c92452ee212115a471e3","lane":"lint","parents":["34935e784e2e8e24e8a88cbf0aa53f4bcc3e2db4"],"secs":null,"stamp":"7d6a7e12a146651aa0807735d997693c","tree":"e6c61c5ab7e831ece2d2d39c86f109b641efb01d","v":1,"via":"reused"}
Ci-Attestation: {"at":1791650057,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"50e370c57f16479ad28e2a575561ae8dd5131f6ea681783224858db553b07813","lane":"rust-test","parents":["34935e784e2e8e24e8a88cbf0aa53f4bcc3e2db4"],"secs":null,"stamp":"c35643f06f43b7ee518fce6c33eb0f56","tree":"e6c61c5ab7e831ece2d2d39c86f109b641efb01d","v":1,"via":"reused"}
Ci-Attestation: {"at":1791650643,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"4a457fbf9a8999dbb800aea2b537349ca37c2fe9d5a6b92244751f111d03b03a","lane":"tier2-linux","parents":["34935e784e2e8e24e8a88cbf0aa53f4bcc3e2db4"],"secs":34,"stamp":"043ee282b3c014052a50e6344853097e","tree":"e6c61c5ab7e831ece2d2d39c86f109b641efb01d","v":1,"via":"run"}
@chriscoveries
chriscoveries merged commit 56f6067 into master Oct 10, 2026
22 checks passed
@chriscoveries
chriscoveries deleted the fix/79-oracle-osfopen-utf8 branch October 11, 2026 02:18

Copy link
Copy Markdown
Owner Author

Source review of current master bacf2abc5d5ef8cd682af0a6ceaaf6e06784ecb2 (not reproduced): this PR’s Windows U+FFFD correction still has a buffered-serializer counterpart. The original buffered port introduced the strict decoder; current path_from_c, lines 30–45 still rejects malformed UTF-8, while the ordinary serializer, lines 41–53 and the Windows C oracle host, lines 23–47 use replacement. This is a follow-up to #4’s parity contract, not a regression introduced by #4.

Smallest acceptance path: adapt the existing cross-platform malformed-name fixture for buffered output; its current counterpart is Unix-only. On Windows, pass a name containing 0xFF, require both inits to succeed in a writable scratch directory, compare write results, close both outputs, then verify contents at the U+FFFD-substituted filenames. Preserve Unix raw-byte behavior and null-path rejection. One private bytes-to-owned-path helper shared by these ports would prevent this policy from drifting again, without changing the C ABI.

CI source review: the retained Windows rust-tests matrix and workspace test command can exercise this fixture; no new workflow is needed. Windows execution remains unverified here.

zackees pushed a commit that referenced this pull request Oct 14, 2026
…-rust#751)

obs-rust#337 made OBS's Stats dock and status bar count the frames of encoders
that rescale the output (Rescale Output), which encode from a video mix
of their own. obs-websocket's GetStats still read obs_get_video(), the
main mix, so while only a rescaled recording ran it reported
outputSkippedFrames / outputTotalFrames = 0 / 0.
obs-rust/obs-websocket#4 takes both values from
obs_get_video_frame_counts(), like the Stats dock. That fix already
shipped with the submodule pin to 547f5ea; this adds the regression
test.

Add a Tier 4 phase: the suite can now start OBS on a profile written
before launch, and "stats with Rescale Output" records at 640x360 from
a 1280x720 canvas for 3 seconds and checks that GetStats counts the
frames. It retries StartRecord while the server answers 207 (NotReady)
during frontend startup. OBS is now started with --multi, so another
OBS on the same machine does not hold it at the single-instance dialog.
The phase fails with 0 / 0 with the submodule at caf0527, the fork
commit before #4 was merged, and passes at 547f5ea.

Refs obs-rust#514.


Local-Gate: v1 tree=2586eb5231297f7e5ac0663ab8afd50d7755feea secs=528 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run
Ci-Attestation: {"at":1792004952,"gate":"rust/all/fmt","host":"linux-x86_64","key":"fb9af536766902129ece46b231d51d356c88cd44b7a4ae4278693b9589973c1d","lane":"lint","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":53,"stamp":"522c5232d38c5379b2dbdf95d6745ae5","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"fb9af536766902129ece46b231d51d356c88cd44b7a4ae4278693b9589973c1d","lane":"lint","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":53,"stamp":"f72e64d0d7ce082ae99190cd946305de","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"f82a96a3ebf8185e9afc6a6936d54c407534dcd196aae1a51d822fd4982f8c3f","lane":"rust-test","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":121,"stamp":"211b88942d2ba50ac8803d0a66ddb031","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"d479cf2a3ac23b07a86c528e60bee7f4","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"a48f50b7437a052e74e2aa246a68bc7a","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"2b3f87af06084f79f56949749d6f7c82","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"c5a41a7056c65e335124d197bda80fd4","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"f85c003f8e3ecc00d28d7870ed9b8e24","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"89a7bf52adb3b008dd2dd6eeb5cfdb92","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"c0c4ea416ea70ee6dcb2acee436be364dea927882183c8c32e588e15bab63775","lane":"tier2-linux","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":244,"stamp":"9c59ada4512d7f5b22fc44fe799716d9","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants