test(pe): cover header layout offsets #311
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!311
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/311/head"
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?
@CesarLopesO on GitHub · 2026-11-24 02:14 UTC · original
CesarLopesO:test/pe-layout-offsets→main· +45 −0 · 1 files · 2 commits · closed without mergingSummary
e_lfanewpointer.Validation
Passed:
cargo test -p victory-pe --lib layout::tests— 4 passed.rustfmt --edition 2024 --check crates/victory-pe/src/layout.rscargo clippy -p victory-pe --all-targets -- -D warningscargo xtask policy— 151 files.git diff --checkEnvironment note:
cargo test --locked -p victory-pereports 4 failures in existingimage::testson Debian/Linux. These tests parse the current test executable as a PE32+ binary, but Linux produces an ELF executable. The failures are in unchangedcrates/victory-pe/src/image.rs; all new layout tests pass.@jeremygold02 on GitHub · 2026-11-24 04:18 UTC · original
Tested PR #311 at head
95f5390a5cebc8ed9ab2349960dd7e93e26b6064(state at test time: OPEN). Pre-comment refresh: state OPEN, head unchanged at95f5390a5cebc8ed9ab2349960dd7e93e26b6064.cargo test --locked -p victory-pe --lib layout::tests— passed (ok. 4 passed; 0 failed; 0 ignored; 0 measured; 6 filtered out; finished in 0.00s ); cases: layout::tests::reads_reject_overflowing_offsets, layout::tests::data_directory_offsets_respect_declared_entry_count, layout::tests::header_offsets_follow_the_dos_header_pointer, layout::tests::header_offset_helpers_reject_truncated_headers.Behavior covered: Checks PE layout offset helpers use the DOS header pointer, respect declared directory counts, and reject truncated/overflowing headers.
Code: crates/victory-pe/src/layout.rs
@ghost on GitHub · 2026-11-24 05:51 UTC · original
Note on head
95f5390: this test and #396 can't both land as written.data_directory_offsets_respect_declared_entry_count(crates/victory-pe/src/layout.rs:114) builds a header whoseSizeOfOptionalHeaderis 0 and expectsdata_directory_offset(&data, 0) == Some(first). #396 bounds the lookup toSizeOfOptionalHeader(itslayout.rs:83–97), so the same input returnsNone. If #396 goes in, settingSizeOfOptionalHeaderin the fixture would keep the test meaningful.Read-only review, nothing built. AI-assisted (Claude Code); the claim above was checked against this head and
mainatd2a4bae. Context: the triage in #366.@Marvisak on GitHub · 2026-11-25 00:01 UTC · original
Automated triage for the maintainers. Closing because another open pull request covers the same change.
See #1171. Three small tests for layout.rs offset helpers; correct (one 'truncated header' assert passes only because the count field reads 0). Fully covered by #1171's layout tests, and the two collide in the same test module.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed