PE tests: cover section RVA boundaries on every host #2740

Open
github-bot wants to merge 1 commit from github-bot/gh-2740 into main AGit
Owner

@⁠XeNS1 on GitHub · 2026-11-25 19:24 UTC · original
XeNS1:codex/pe-section-rva-boundaries-20261126 → main · +88 −4 · 1 files · 1 commits · open

The section RVA overflow regression parsed the host test executable, so it failed on Linux before reaching the mapper. The remaining section boundary behavior had no focused coverage for raw padding, zero-filled virtual tails, or multiple sections.

Use the existing source-generated PE fixture for that regression and check the last representable file offset and the first overflowing offset. Add four tests with explicit expected mappings for the smaller of virtual/raw size, zero VirtualSize, empty sections and gaps in both section orders, and RVAs near u32::MAX. Production code is unchanged. Header RVA/TLS work in #1639 and delay-import coverage in #2731 remain separate.

Validation (native Linux x86-64, Rust 1.100.0, two build jobs):

  • cargo test -p victory-pe --locked --offline -- --skip parses_own_test_binary --skip rva_to_file_offset_maps_entry_point --skip rejects_iat_outside_image: 37 passed, 0 failed. Those three unchanged tests need a Windows PE host executable; the baseline had 32 pass / 4 fail, including the now-portable overflow regression.
  • Strict all-target/all-feature Clippy, changed-file rustfmt, repository/staged asset policy and diff checks pass.
  • In a separate temporary crate, all six mutations are caught: min -> max extent, inclusive end, missing zero-VirtualSize fallback, wrapping file offset, wrapping RVA subtraction, and first-section-only lookup. The unmodified snapshot passes all 37 portable tests.
  • Full Windows workspace CI passes both Clippy configurations and workspace tests on f0d5342 (run).

Integration with #2731 at 694baa3 also applies without conflicts: 41 portable PE tests pass, strict Clippy and staged policy pass (independent Linux report).

All fixtures are generated from source. No game files, binaries or GPU execution used. AI-assisted: OpenAI Codex.

Coordination claim.

**@⁠XeNS1** on GitHub · 2026-11-25 19:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/2740) `XeNS1:codex/pe-section-rva-boundaries-20261126` → `main` · +88 −4 · 1 files · 1 commits · open The section RVA overflow regression parsed the host test executable, so it failed on Linux before reaching the mapper. The remaining section boundary behavior had no focused coverage for raw padding, zero-filled virtual tails, or multiple sections. Use the existing source-generated PE fixture for that regression and check the last representable file offset and the first overflowing offset. Add four tests with explicit expected mappings for the smaller of virtual/raw size, zero VirtualSize, empty sections and gaps in both section orders, and RVAs near u32::MAX. Production code is unchanged. Header RVA/TLS work in #1639 and delay-import coverage in #2731 remain separate. Validation (native Linux x86-64, Rust 1.100.0, two build jobs): - `cargo test -p victory-pe --locked --offline -- --skip parses_own_test_binary --skip rva_to_file_offset_maps_entry_point --skip rejects_iat_outside_image`: 37 passed, 0 failed. Those three unchanged tests need a Windows PE host executable; the baseline had 32 pass / 4 fail, including the now-portable overflow regression. - Strict all-target/all-feature Clippy, changed-file rustfmt, repository/staged asset policy and diff checks pass. - In a separate temporary crate, all six mutations are caught: min -> max extent, inclusive end, missing zero-VirtualSize fallback, wrapping file offset, wrapping RVA subtraction, and first-section-only lookup. The unmodified snapshot passes all 37 portable tests. - Full Windows workspace CI passes both Clippy configurations and workspace tests on f0d5342 ([run](https://github.com/Marvisak/VIctory/actions/runs/45684874254)). Integration with #2731 at 694baa3 also applies without conflicts: 41 portable PE tests pass, strict Clippy and staged policy pass ([independent Linux report](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2731)). All fixtures are generated from source. No game files, binaries or GPU execution used. AI-assisted: OpenAI Codex. [Coordination claim](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:13:10 +00:00
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 20:14 UTC · original

Reviewed and verified f0d53421 on Windows 11 (rustc 1.98.1 MSVC) against main (13f91ca).

  • Replacing own_image() with the synthetic section_image(virtual_size, raw_size) fixture makes the 4 GiB boundary test portable across hosts, and the 4 new tests thoroughly cover min(VirtualSize, SizeOfRawData), VirtualSize == 0, empty sections/gaps (both forward and reverse section orders), and u32::MAX wraparound avoidance.
  • cargo test -p victory-pe --locked: 40 passed, 0 failed; cargo clippy -p victory-pe --all-targets --locked -- -D warnings: 0 warnings; cargo xtask policy: 184 files ok.
  • Clean git merge-tree against 13f91ca and #2741 (complementary: #2740 covers section RVA boundaries, #2741 rejects null IAT RVAs in non-empty import descriptors).
**@⁠fuzeofficlal** on GitHub · 2026-11-25 20:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/2740#issuecomment-7173383090) Reviewed and verified `f0d53421` on Windows 11 (`rustc 1.98.1` MSVC) against `main` (`13f91ca`). - Replacing `own_image()` with the synthetic `section_image(virtual_size, raw_size)` fixture makes the 4 GiB boundary test portable across hosts, and the 4 new tests thoroughly cover `min(VirtualSize, SizeOfRawData)`, `VirtualSize == 0`, empty sections/gaps (both forward and reverse section orders), and `u32::MAX` wraparound avoidance. - `cargo test -p victory-pe --locked`: **40 passed, 0 failed**; `cargo clippy -p victory-pe --all-targets --locked -- -D warnings`: **0 warnings**; `cargo xtask policy`: **184 files ok**. - Clean `git merge-tree` against `13f91ca` and `#2741` (complementary: `#2740` covers section RVA boundaries, `#2741` rejects null IAT RVAs in non-empty import descriptors).
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 20:58 UTC · original

Independent WARP/CPU verification of f0d53421 (#2740).

Review: Test-only change in victory-pe/src/image.rs (no production change). The new section_image helper builds a synthetic section, and the tests cover the shorter-of-virtual/raw-size rule, VirtualSize == 0, empty sections and gaps, section-table order, and RVAs near u32::MAX. It no longer relies on own_image(). I found no problems.

Results (WARP/CPU):

  • origin/main: cargo test -p victory-pe --lib: 36 passed.
  • PR: 40 passed, 0 failed.
  • cargo clippy --locked -p victory-pe --all-targets [--all-features] -- -D warnings: clean. cargo test -p xtask (policy): 6 passed.

Negative control (mutating rva_to_file_offset on the PR head):

  • vs.min(file_size) changed to vs: section_rvas_stop_at_the_shorter_of_virtual_and_raw_data and section_rvas_skip_empty_sections_and_gaps fail.
  • checked_add changed to wrapping_add: rva_to_file_offset_rejects_offsets_past_4_gib fails.
  • 0 => file_size changed to 0 => 0: section_rvas_use_raw_size_when_virtual_size_is_zero fails.

Each mutation is caught, so the tests do guard the behaviour.

Method: no physical GPU. VICTORY_WARP=1, VICTORY_D3D12_WARP=1, Windows SDK 10.0.26100 dxil.dll on PATH, Windows 11, rustc 1.98.1 MSVC, --locked. Compared origin/main (13f91ca) with the PR head. The PR merges cleanly onto that main. No game files, dumps, shader names or retail hashes were used or are needed.

AI disclosure: this verification was done by Claude Code / Claude Sonnet 5.5.

**@⁠oni-swr** on GitHub · 2026-11-25 20:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/2740#issuecomment-7174431602) Independent WARP/CPU verification of `f0d53421` (#2740). **Review:** Test-only change in `victory-pe/src/image.rs` (no production change). The new `section_image` helper builds a synthetic section, and the tests cover the shorter-of-virtual/raw-size rule, `VirtualSize == 0`, empty sections and gaps, section-table order, and RVAs near `u32::MAX`. It no longer relies on `own_image()`. I found no problems. **Results (WARP/CPU):** - `origin/main`: `cargo test -p victory-pe --lib`: 36 passed. - PR: 40 passed, 0 failed. - `cargo clippy --locked -p victory-pe --all-targets [--all-features] -- -D warnings`: clean. `cargo test -p xtask` (policy): 6 passed. **Negative control (mutating `rva_to_file_offset` on the PR head):** - `vs.min(file_size)` changed to `vs`: `section_rvas_stop_at_the_shorter_of_virtual_and_raw_data` and `section_rvas_skip_empty_sections_and_gaps` fail. - `checked_add` changed to `wrapping_add`: `rva_to_file_offset_rejects_offsets_past_4_gib` fails. - `0 => file_size` changed to `0 => 0`: `section_rvas_use_raw_size_when_virtual_size_is_zero` fails. Each mutation is caught, so the tests do guard the behaviour. Method: no physical GPU. `VICTORY_WARP=1`, `VICTORY_D3D12_WARP=1`, Windows SDK 10.0.26100 `dxil.dll` on `PATH`, Windows 11, rustc 1.98.1 MSVC, `--locked`. Compared `origin/main` (`13f91ca`) with the PR head. The PR merges cleanly onto that main. No game files, dumps, shader names or retail hashes were used or are needed. AI disclosure: this verification was done by Claude Code / Claude Sonnet 5.5.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 23:23 UTC · original

Automated triage for the maintainers.

Test-only change in crates/victory-pe/src/image.rs: rva_to_file_offset_rejects_offsets_past_4_gib now uses a source-built fixture (section_image) instead of the test executable and checks the exact last representable offset and the first overflowing one, and four new tests pin ImageInfo::rva_to_file_offset on the shorter of VirtualSize/SizeOfRawData, VirtualSize 0, empty sections and gaps in both section orders, and RVAs near u32::MAX. I worked the expected values through the current rva_to_file_offset (the backed extent and checked_add) and they match; no production code changes, and it does not overlap the delay-import tests in #2731. CI (check) passes.

This is a recommendation for a maintainer to look, not an approval.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 23:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2740#issuecomment-7177498939) <!-- victory-triage v1 head=f0d53421294ec3a3bfee5f7bb591eff2a906ca5f verdict=merge-candidate at=2026-11-25T23:23:31Z --> Automated triage for the maintainers. Test-only change in `crates/victory-pe/src/image.rs`: `rva_to_file_offset_rejects_offsets_past_4_gib` now uses a source-built fixture (`section_image`) instead of the test executable and checks the exact last representable offset and the first overflowing one, and four new tests pin `ImageInfo::rva_to_file_offset` on the shorter of VirtualSize/SizeOfRawData, VirtualSize 0, empty sections and gaps in both section orders, and RVAs near `u32::MAX`. I worked the expected values through the current `rva_to_file_offset` (the `backed` extent and `checked_add`) and they match; no production code changes, and it does not overlap the delay-import tests in #2731. CI (`check`) passes. This is a recommendation for a maintainer to look, not an approval. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 12:39 UTC · original · approved these changes

Reviewed and verified at head f0d53421 and merged onto origin/main (63bcca43) on Windows 11 (debug & --release):

  • Design & correctness: test-only change in crates/victory-pe/src/image.rs:477-490, 547-626 with zero production edits. Replacing own_image() with the source-built section_image(virtual_size, raw_size) helper makes rva_to_file_offset_rejects_offsets_past_4_gib portable across non-Windows hosts while pinning the exact u32::MAX boundary (0x1010 -> Some(u32::MAX), 0x1011 -> None). The four new tests thoroughly cover min(VirtualSize, SizeOfRawData), VirtualSize == 0 fallback to SizeOfRawData, empty sections and inter-section gaps in both forward and reversed section-table order, and wraparound near u32::MAX.
  • Verification:
    • Clean git merge-tree against origin/main (63bcca43); cargo xtask policy (184 files ok); cargo clippy -p victory-pe --all-targets --locked -- -D warnings clean with default features and --all-features.
    • cargo test -p victory-pe --locked: 40/40 passed in debug, --release, and merged onto origin/main (63bcca43).

LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 12:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/2740#pullrequestreview-6074271627) · **approved these changes** Reviewed and verified at head `f0d53421` and merged onto `origin/main` (`63bcca43`) on Windows 11 (debug & `--release`): - **Design & correctness**: test-only change in `crates/victory-pe/src/image.rs:477-490, 547-626` with zero production edits. Replacing `own_image()` with the source-built `section_image(virtual_size, raw_size)` helper makes `rva_to_file_offset_rejects_offsets_past_4_gib` portable across non-Windows hosts while pinning the exact `u32::MAX` boundary (`0x1010 -> Some(u32::MAX)`, `0x1011 -> None`). The four new tests thoroughly cover `min(VirtualSize, SizeOfRawData)`, `VirtualSize == 0` fallback to `SizeOfRawData`, empty sections and inter-section gaps in both forward and reversed section-table order, and wraparound near `u32::MAX`. - **Verification**: - Clean `git merge-tree` against `origin/main` (`63bcca43`); `cargo xtask policy` (`184 files ok`); `cargo clippy -p victory-pe --all-targets --locked -- -D warnings` clean with default features and `--all-features`. - `cargo test -p victory-pe --locked`: **40/40 passed** in debug, `--release`, and merged onto `origin/main` (`63bcca43`). LGTM.
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-26 12:57 UTC · original

NVIDIA full-suite run, to go with the reports above by fuzeofficlal, oni-swr, since none of them names a GPU run. Tested exact head f0d5342 (on its base 13f91ca).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 777 passed, 0 failed, 9 ignored.
  • The new tests ran and passed: section_rvas_stop_at_the_shorter_of_virtual_and_raw_data, section_rvas_use_raw_size_when_virtual_size_is_zero, section_rvas_skip_empty_sections_and_gaps, section_rvas_near_u32_max_do_not_wrap.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-26 12:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/2740#issuecomment-7192679711) NVIDIA full-suite run, to go with the reports above by fuzeofficlal, oni-swr, since none of them names a GPU run. Tested exact head `f0d5342` (on its base `13f91ca`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **777 passed, 0 failed, 9 ignored**. - The new tests ran and passed: `section_rvas_stop_at_the_shorter_of_virtual_and_raw_data`, `section_rvas_use_raw_size_when_virtual_size_is_zero`, `section_rvas_skip_empty_sections_and_gaps`, `section_rvas_near_u32_max_do_not_wrap`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2740/head:github-bot/gh-2740'
git switch 'github-bot/gh-2740'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2740'
git switch 'github-bot/gh-2740'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2740'
git switch 'github-bot/gh-2740'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2740'
git switch 'main'
git merge --squash 'github-bot/gh-2740'
git switch 'main'
git merge --ff-only 'github-bot/gh-2740'
git switch 'main'
git merge 'github-bot/gh-2740'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2740
No description provided.