Skip to content

[upstream #1107] Shaders: scan short archive records at the end of the input - #51

Closed
ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1107
Closed

ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1107

Conversation

@ufoptg

@ufoptg ufoptg commented Nov 24, 2026

Copy link
Copy Markdown
Owner

I fixed pack::scan dropping valid short records at the end of its input. The loop required more than 32 bytes remaining, but the accepted record format needs only 23 bytes at minimum. A synthetic 28-byte record was ignored without trailing padding.

What is in it

  • Use the actual minimum candidate size; keep the existing name, header, payload and overflow checks.
  • Add a regression for 28- and 32-byte final records, both at offset zero and after a prefix, including inflation of their payloads.
  • Document unpadded final-record support in the RPF tool guidance.

Tested

  • macOS Darwin 24.6.0, arm64; rustc 1.99.1, miniz_oxide 0.9.1; debug. No GPU used.

  • A temporary Cargo harness linked the actual repository crates/xcl/src/gpu/pack.rs as its library, without compiling the Windows runtime or mocking the scanner.

  • Before the fix, cargo test --offline --manifest-path /tmp/xcl-pack-probe.ANtIu4/Cargo.toml --test short_records failed: the 28-byte record returned no records.

  • After the fix, cargo test --offline --manifest-path /tmp/xcl-pack-probe.ANtIu4/Cargo.toml --test short_records --test bounds: 2 passed, 0 failed, 0 ignored, 0 skipped. The harness checked four short-record/prefix combinations plus short buffers and out-of-range offsets, and was removed afterward.

  • Windows 11 Pro ARM64 10.0.26100.1742 in UTM (4 GiB VM RAM, Red Hat VirtIO GPU DOD), running x64 binaries through Windows emulation; rustc 1.100.0 x86_64-pc-windows-msvc, Windows SDK 26100. Debug build with CARGO_PROFILE_DEV_DEBUG=0, CARGO_PROFILE_TEST_DEBUG=0, CARGO_BUILD_JOBS=1; no GPU tests selected.

  • Exact source archive 5ab17d4fc701aecb1b3b017229b08a908114a5ee, after cargo clean -p xcl: cargo test --locked -p xcl --lib gpu::pack -- --test-threads=4: 5 passed, 0 failed, 0 ignored, 715 filtered out; no SKIPPED lines. The new short_records_do_not_need_trailing_padding test ran and passed. An earlier shared-cache run reused the prior test executable and is not counted as verification of this revision.

Regression run

  • Not run. Required main/head Windows title smoke blocks remain outstanding; this PR is a draft.

Not tested

  • Full Windows/GPU suite, native x64 hardware, CLI extraction path and real game archives. The focused Windows run is not a full workspace or title run.

AI use

  • I used omp (openai-codex/gpt-6-astra) to find and reproduce the boundary bug, write the fix and regression, run the isolated native harness and focused Windows tests, and prepare this description.

Mirror of xcl-dev#1107 (auto-synced, do not edit).

The scanner stopped with 32 bytes remaining even though its format permits
a 23-byte candidate. Valid short records were found with padding but lost
when they were the archive's final record.

Use the actual minimum candidate size. Cover 28- and 32-byte records at
the start and after a prefix, and document unpadded final-record support.

A temporary native harness linked the real pack.rs with miniz_oxide 0.9.1:
the short-record test failed before the change; afterward 2 tests passed
(short records and bounds). This is not a Windows workspace test run.
Windows/GPU tests and main/head title smoke runs remain outstanding.

Assisted-by: omp (openai-codex/gpt-6-astra)
@ufoptg

ufoptg commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

Upstream PR xcl-dev#1107 was closed or merged.

@ufoptg ufoptg closed this Nov 25, 2026
@ufoptg
ufoptg deleted the upstream-pr/1107 branch November 25, 2026 00:13
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.

2 participants