Scripts: skip invalid or truncated DXBC matches in bvhb_shaders #1483
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1493"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by microwave805 on 2026-11-24T16:54:20Z.
scripts/re/bvhb_shaders.pyscans an input binary for rawb'DXBC'occurrences and unconditionally unpacked the size at+24and every chunk offset inparts(). Ab'DXBC'near EOF, a truncated container, or a false-positive match with an in-range dword at+24raisedstruct.errorand aborted extraction before later real DXBC containers were reached.What is in it
scripts/re/bvhb_shaders.py: check header bounds before unpacking, validate DXBC version== 1, container length against the file size, non-zero part count, and every chunk's offset and size insideparts(), skipping invalid candidates cleanly.scripts/test_bvhb_shaders.py: add a synthetic binary containing bogus-version, out-of-bounds-offset, valid, truncated, and trailing-EOFDXBChits and verify only the valid container is extracted.Tested
stable-x86_64-pc-windows-msvc, debug), Python 3.11.3python -I -m unittest discover -s scripts -p "test_bvhb_shaders.py" -v: 1 passed, 1 error (exit status 1 on invalidDXBChit)7a0ed4c:python -I -m unittest discover -s scripts -p "test_*.py" -v: 17 passed, 0 failed.\scripts\test.ps1(cargo build --workspace && cargo test --workspace -- --test-threads=4): 770 passed, 0 failed, 41 ignoredgpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)Regression run
scripts/re/bvhb_shaders.pyandscripts/test_bvhb_shaders.py(no runtime or build-input files).Not tested
XboxBvhBuilder.dllbinary (no console binaries)AI use
scripts/re/bvhb_shaders.py, wrote the fix, unit test, and PR description, and ran the verification commands above.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T18:53:31Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by jeroenhaentjens on 2026-11-25T13:26:11Z.
Independent Windows/NVIDIA validation of
7a0ed4c62372767a5068b190b8136071a03abaf2(the PR head, detached checkout with no source changes).Tested
32.0.15.9706; Rust 1.100.0; Python 3.10.0.python -B -m unittest discover -s scripts -p 'test_*.py' -v: 17 passed, exit 0.cargo build --workspace --locked: passed, exit 0.cargo test --workspace --locked --no-fail-fast -- --test-threads=4: 770 passed, 0 failed, 41 ignored, 20 completed suites, exit 0.CARGO_PROFILE_DEV_DEBUG=0,CARGO_PROFILE_TEST_DEBUG=0),CARGO_INCREMENTAL=0,XCL_ADAPTER=nvidia,XCL_HEAP_WINDOWS=1, andXCL_DXC_DIRpointing to DXC 1.9.2609.5.Two explicit GPU skip records, included in Cargo's passed count and not counted as exercised coverage:
gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64.gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64.I also ran five separate, game-data-free CLI cases against the PR script and
HEAD^'s script:DXBCat EOFDXBCat EOFThe four parent failures were
struct.error. Every extracted file on the PR matched the synthetic valid input byte for byte. The valid fixture was a single RTS0 chunk containingstruct.pack('<6I', 1, 0, 24, 0, 0, 0).Not tested
XCL_SAMPLE_*variables were unset, so sample-dependent tests do not establish coverage of game data.AI use
Codex generated the additional synthetic cases, ran the commands and wrote this report. The exact model identifier was not exposed in this session.
Imported from ivall/xcl. Originally posted by upipibi on 2026-11-26T22:03:12Z.
Tested head
7a0ed4c62372767a5068b190b8136071a03abaf2(merge-base with mainb7aa9f3bd212088e0d927439284dc5ed325ce3c7) on Windows 11 Pro 26100, Python 3.13.0, CPU only.cd scripts; py -3.13 -m unittest test_bvhb_shaders: head 2 passed, 0 failed; merge-base 1 passed, 0 failed. Negative control: PR's test hunk alone on the merge-base gives 1 passed, 1 failed (test_skips_false_positive_and_truncated_dxbc_headers: CalledProcessError, bvhb_shaders.py exits 1).Not tested: GPU, retail title, real game binaries. AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted).
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:35:56Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:55:26Z.
Triage (#1607) – head
7a0ed4c#1858 also stops scripts/re/bvhb_shaders.py from reading past truncated DXBC matches, but in a different way: it bounds-checks the reads inside a larger CLI rewrite and still extracts false-positive blobs, while this PR validates the container (version 1, total size, part offsets/sizes) and skips the match.
No problems found in the diff; the header fields read at offset 20 (version, total size, part count) follow the DXBC layout.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.