Repository navigation
test: Keep NULs out of the writer parity prefix - #3811
Merged
Merged
Conversation
The writer parity test's model can start the shader string with text already in it, generated from any bytes, so it can hold a NUL byte while the dstr's len counts past it. A dstr never looks like that, and the C writer's dstr helpers rely on it: proptest then finds a case where the two writers' strings differ by the generator, not the writer. Move the prefix strategy into its own function and check, drawing from a fixed seed, that it never makes a prefix holding a NUL. It fails on the current generator every run. Refs #3802.
This was referenced Nov 7, 2026
Draw the prefix's bytes from 1..=255, keeping its length range, spare capacity and None case, so the shader string the writers append to is always a valid dstr. Neither writer changes; the compile step always passes an empty dstr, so no real input reached the difference. Over 40 runs of the module the old generator first failed called_functions and random_parsers on the 5th; with this, all 40 pass. Fixes #3802. Local-Gate: v1 tree=598c0a750d9a9bc4e394c848f2bf4ce8f5027748 secs=2206 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run,macos-native:n/a,windows-native:n/a Ci-Attestation: {"at":1794033285,"gate":"rust/all/fmt","host":"linux-x86_64","key":"71d4f449b370a5fd66085a37efb5e696057826be30218237586fc21eb8262e58","lane":"lint","parents":["20b605af7d1ac3ef92886db199213ece800bccf3"],"secs":50,"stamp":"f6fc2c6f441294f5f3cd133cb55ddfd7","tree":"598c0a750d9a9bc4e394c848f2bf4ce8f5027748","v":1,"via":"run"} Ci-Attestation: {"at":1794033285,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"71d4f449b370a5fd66085a37efb5e696057826be30218237586fc21eb8262e58","lane":"lint","parents":["20b605af7d1ac3ef92886db199213ece800bccf3"],"secs":50,"stamp":"ef5306c0dd020526ec6c0cf9445f6aa7","tree":"598c0a750d9a9bc4e394c848f2bf4ce8f5027748","v":1,"via":"run"} Ci-Attestation: {"at":1794033285,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"fd20930d309444f1274cc74d669dbb15aa5916a382298ddf6ef531ad25504d06","lane":"rust-test","parents":["20b605af7d1ac3ef92886db199213ece800bccf3"],"secs":111,"stamp":"f8eea67e13d62a58decdc8548a8c3de7","tree":"598c0a750d9a9bc4e394c848f2bf4ce8f5027748","v":1,"via":"run"} Ci-Attestation: {"at":1794033285,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"5fd1fdfa3352a8d678730601ecf6829ca648247eff6a14084acd84479448d78d","lane":"cross","parents":["20b605af7d1ac3ef92886db199213ece800bccf3"],"secs":62,"stamp":"9f1bec0bfb311ed6b2a9ed112bec8066","tree":"598c0a750d9a9bc4e394c848f2bf4ce8f5027748","v":1,"via":"run"} Ci-Attestation: {"at":1794033285,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"5fd1fdfa3352a8d678730601ecf6829ca648247eff6a14084acd84479448d78d","lane":"cross","parents":["20b605af7d1ac3ef92886db199213ece800bccf3"],"secs":62,"stamp":"98ecf73c2fdf7092c15eb9fa4d27b01d","tree":"598c0a750d9a9bc4e394c848f2bf4ce8f5027748","v":1,"via":"run"} Ci-Attestation: {"at":1794033285,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"5fd1fdfa3352a8d678730601ecf6829ca648247eff6a14084acd84479448d78d","lane":"cross","parents":["20b605af7d1ac3ef92886db199213ece800bccf3"],"secs":62,"stamp":"bf88fc6089fa92dbfcea3d8c5aede229","tree":"598c0a750d9a9bc4e394c848f2bf4ce8f5027748","v":1,"via":"run"} Ci-Attestation: {"at":1794033285,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"5fd1fdfa3352a8d678730601ecf6829ca648247eff6a14084acd84479448d78d","lane":"cross","parents":["20b605af7d1ac3ef92886db199213ece800bccf3"],"secs":62,"stamp":"6bc31eaa8ff14dc572ecc40cc439f3f7","tree":"598c0a750d9a9bc4e394c848f2bf4ce8f5027748","v":1,"via":"run"} Ci-Attestation: {"at":1794033285,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"5fa774bf99b57add8160684d2db211330eda8dabf80550fb73e8024f2dd2bff2","lane":"tier2-linux","parents":["20b605af7d1ac3ef92886db199213ece800bccf3"],"secs":2206,"stamp":"a80c3019e34ef5a7b6d91800c7ff89d9","tree":"598c0a750d9a9bc4e394c848f2bf4ce8f5027748","v":1,"via":"run"}
rdoupe
force-pushed
the
fix/3802-bug-obs-graphics-writer-parity-t
branch
from
November 7, 2026 06:35
d443f04 to
e11ceb6
Compare
rdoupe
marked this pull request as ready for review
November 7, 2026 07:01
Collaborator
Author
|
Handed off to the coordinator |
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 #3802
What and why
The effect parser writer parity test (
shader::effect_parser_writer_parity) can start the shader string with text already in it. That prefix was generated from any bytes, so now and then it held a NUL byte while the dstr'slencounted past it. Astruct dstrnever looks like that (itslenis the length of its text up to the terminating NUL), and the dstr helpers the C writer calls rely on it, so proptest occasionally reported a Rust/C mismatch incalled_functionsorrandom_parsersthat came from the generator, not from either writer. The compile step always passes an empty dstr, so no real input reaches this.This draws prefix bytes from
1u8..=255, keeping the prefix's length range, spare capacity and itsNonecase, and addsprefix_is_dstr_text, which draws 20,000 prefixes from a fixed seed and fails if any holds a NUL. Neither writer changes. The failing model from the issue can't be pinned as a regression case: the writers really do differ on it, and with the fix the generator can no longer make it. No upstream issue.RED → GREEN
test: Check the writer parity prefix has no NUL).shader::effect_parser_writer_parity::prefix_is_dstr_textfails:prefix [15, 6, 0, 209, 165] holds a NUL; the module's other tests pass.--lane lintpasses and--test-diff origin/masterfails only that test.called_functionsandrandom_parsers, both shrinking to a[0]prefix).--test-diff: 6382 passed, 6 skipped;./unittest: Rust 6744 passed, 6 skipped, and 912 passed, Tier 2 747/747 on both builds;--lane lintand--lane crosspass; MSVCclippy --workspace --all-targets -D warningsis clean; the local gate stamped the head (lint, rust-test, cross, tier2-linux). No C, libobs or export changes.Runs were on d443f04 (RED, before the rebase onto current master), e83528a97 (GREEN: the 40-run loop,
--test-diff) and e11ceb6 (GREEN after the rebase:./unittest, the lanes, the Windows clippy and the stamp).Test cost: one new test, longest 8 ms, peak RSS 6.2 MB over 5 runs, no own threads.
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 (not applicable: no warning or flag changes)