PE: checked offsets in rva_to_file_offset and layout, remove dbg_tls #30
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/30"
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 Marvisak/VIctory. Originally posted by AndyLatimer on 2026-11-23T23:27:50Z.
Two small checked-arithmetic fixes and a test cleanup in
victory-pe:ImageInfo::rva_to_file_offset(image.rs): switchess.file_offset + deltatochecked_addso a section header withPointerToRawDatanear 4 GiB returnsNoneinstead of overflowingu32(panic in debug builds, wrapped offset in release). Adds regression testrva_to_file_offset_rejects_offsets_past_4_gib.layout.rs): switchesread_u32,read_u64,optional_header_offset,file_header_offsetanddata_directory_offsetto checked arithmetic so extreme offsets returnNoneinstead of overflowing. Adds regression testreads_reject_overflowing_offsets.image.rs): removes the leftover print-onlydbg_tls::dump_tlstest (TLS presence is already asserted inparses_own_test_binary).Testing
cargo test -p victory-pe: 6 passed, 0 failed.cargo clippy -p victory-pe --all-targets: 0 warnings.cargo xtask policy: pass (148 files).Imported from Marvisak/VIctory. Originally posted by DaviTostes on 2026-11-24T00:00:00Z.
Could not run the Linux check for this head: it conflicts with #39 (the PR that makes the workspace build and test on Linux), so it cannot be stacked without a rebase.
crates/victory-pe/src/image.rs, in themod tests/dbg_tlsregion. This PR removes the leftoverdbg_tlstest and checks layout offsets; #39 adds#[cfg(windows)]gates aroundown_imageand the tests that read the running binary. Both touch the same block.A rebase of this branch onto #39 (or a version of it after #39 lands) would let me run
cargo test --workspacehere and report the result.AI-assisted (DeepSeek V4.1 Flash coding agent).
Imported from Marvisak/VIctory. Originally posted by lordon1a on 2026-11-24T00:20:04Z.
Verified
ef22723e8on Windows 11 (x86_64-pc-windows-gnullvm,rustc 1.100.0, applied cleanly tomain@35b054ec0): pass.cargo xtask policy: 150 files okcargo test -p victory-pe: 6 passed, 0 failed (+1 new checked-offset test).AI-assisted.