Repository navigation
Conversation
A crafted image whose FirstThunk or TLS AddressOfIndex lands below SizeOfHeaders would overwrite the mapped headers before they are re-read. Reject those write targets in pe.rs once (PeError::HeaderWriteTarget), including delay-load HMODULE slots. Fixes xcl-dev#836 Assisted-by: Cursor Auto (Composer) Co-authored-by: Cursor <cursoragent@cursor.com>
ensure_data_write_rva only checked the first byte of the slot. The loader writes 8 bytes for IAT/HMODULE and 4 for AddressOfIndex, so a target at SizeOfImage-4 could still overwrite past the mapping. Require the whole write to fit, matching the reloc bounds idea from xcl-dev#291 for these slots. Stacked on xcl-dev#854. Assisted-by: Cursor Auto (Composer) Co-authored-by: Cursor <cursoragent@cursor.com>
|
Independent verification on current Machine: Windows 11, Ryzen 9 7900X; Rust stable MSVC, debug.
AI use: test runs by Devin (Cognition, SWE-2); no code changes. |
|
A run on Linux under Wine. Tested
Not tested
AI use
|
|
Regression run of Against the limits in CONTRIBUTING.md: 101 % of AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, AI use: Claude Code (Claude Opus 5.5) built both trees and ran |
|
Thanks @Toons29 — pasted both of your |
|
CI is stuck on |
|
Full workspace run (listed under Not tested). Setup: RTX 3060 12 GB (32-lane waves, driver 32.0.16.2101), Ryzen 5 5600X, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0, DXC 1.9.2609.5, debug build. Head c97bd9f. Result: cargo test --workspace -- --test-threads=4: 747 passed, 0 failed, 41 ignored. SKIPPED: 2 GPU tests for no wave64 (expected on this card). AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report. |
|
Thanks @jennydeth — copied your workspace counts into Tested (747 passed, 0 failed, 41 ignored. SKIPPED: 2 GPU tests for no wave64 (expected on this card)). |
…xcl-dev#1203) Port the combined final shape (pr1203head = c97bd9f, child of pr854head = 6ce1240; both still OPEN vs upstream/main, merge-base false): PeError::HeaderWriteTarget + ensure_data_write_rva(rva, width) with the whole-width [headers, image) guard, checked on the import-thunk IAT slot (8B), the delay-load HMODULE slot (8B), and the TLS AddressOfIndex slot (4B), plus pe_with_headers + 6 boundary tests as-is. Reconcile: tree already has checked_add(2) from step-82 where xcl-dev#854's base shows wrapping_add; kept checked_add and added the ensure call on top. Pre-existing saturating_add(8) outside-image guards stay; ensure adds the header-floor and the straddle (checked_add(width)) ceiling. Failing-first: new tests reference HeaderWriteTarget/ensure, both absent pre-fix (E0599); header payloads that pre-fix mis-read as BadRva(0x8000…) now report HeaderWriteTarget(0x80). Gates: both checks 0 errors; lib 743/0/1 (+6); title 12 unique FAILs all D3D12.X GPU-only 0 non-GPU; retail SIGSEGV +0x2237320 exit 139 stubs 20.
|
Nothing has happened on this PR for 3 days, so it is marked |
|
Still waiting on a maintainer: description/smoke are in place; CI needs first-time-contributor workflow approval. Not abandoned. |
|
Stacked on #854 (same author): the shared lines are #854's commits. This PR's own change makes AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
Stacked on #854; only the top commit belongs here.
#854 rejects IAT / delay-load HMODULE / TLS-index writes whose first byte is inside the headers or at/after
SizeOfImage. The loader still writes 8 bytes (IAT, HMODULE) or 4 bytes (TLS index), so a slot atSizeOfImage - 4could overwrite past the mapped image. Require the whole write to fit — the same bounds idea #291 applied to relocations.What is in it
crates/xcl/src/pe.rs:ensure_data_write_rva(rva, width)and tests for an IAT and TLS index that straddle the image endTested
c97bd9f98c2f136301658f5532709b5e313339f2(clean tree)cargo test --workspace -- --test-threads=4: 747 passed, 0 failed, 41 ignored. SKIPPED: 2 GPU tests for no wave64 (expected on this card)SKIPPED: 2 GPU tests for no wave64 (expected on this card)Regression run
scripts/smoke.ps1from @Toons29 (RX 9070, 60 s, same title/time; blocks as printed):Not tested
cargo test --workspacewidth=8path as IAT)AI use