Scripts: read PE exports stored in image headers #1675
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1685"
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 ivall/xcl. Originally posted by jeroenhaentjens on 2026-11-24T19:15:58Z.
scripts/re/pe_exports.pyraisesValueError: 0x200for exports stored in PE image headers. Resolve header RVAs directly, bounded bySizeOfHeadersand file length, before searching sections.What is in it
Tested
30852cf11b086bef9daaf8de3450122d2a0a3068; basec160d86ef2efe3a07e4dfb473e4fa72eafb413c0.CARGO_INCREMENTAL=0,CARGO_PROFILE_DEV_DEBUG=0,CARGO_PROFILE_TEST_DEBUG=0to limit disk usage.XCL_ADAPTER=nvidia;XCL_DXC_DIRpoints to DXC's x64 binaries.cargo build --workspace --locked: passed on PR and base.cargo test --workspace --locked --no-fail-fast -- --test-threads=4: final PR run 858 passed, 0 failed, 42 ignored; base run identical. Built-in test-title e2e tests passed.coherent_buffer_sanitizes_console_flags_and_statefailed itsVirtualFreeassertion atreal.rs:5825. The exact test passed alone (cargo test -p xcl --lib coherent_buffer_sanitizes_console_flags_and_state -- --test-threads=1 --nocapture); a full rerun passed with no source changes. Cause remains unconfirmed; this intermittent result is disclosed for maintainer review.gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no native wave64);heap_window_out_of_memory_falls_back_to_the_switch_form(opt-in disabled).XCL_HEAP_WINDOWS=1:cargo test -p xcl --test gpu_compute_e2e heap_window_out_of_memory_falls_back_to_the_switch_form -- --exact --test-threads=1 --nocapture: 1 passed, 0 failed, no GPU skips, real NVIDIA backend confirmed.python -m unittest discover -s scripts -p 'test_*.py' -v: 17 passed, 0 failed, 0 skipped. New regression fails on unpatched main for both PE32/PE32+.git diff --check: passed; working tree clean.Regression run
Not tested
XCL_SAMPLE_*inputs supplied: tests that return early without sample data are not retail coverage, even when Cargo reports them as passed.AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T21:47:35Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
upstream-sync referenced this pull request2026-11-25 06:04:27 +00:00
Imported from ivall/xcl. Originally posted by RavenCurseBurg on 2026-11-26T01:38:45Z.
Tested
30852cf11b086bef9daaf8de3450122d2a0a3068against the same header RVA change ported onto #1814 (parent0180bf493cb1).I ran
python -B scripts/re/pe_exports.py <eight fixtures> %WINDIR%\System32\version.dll %WINDIR%\SysWOW64\version.dllwith all ten paths in one invocation on each revision. The two readers printed identical output for all ten files.FixtureValue, RVA0x1180.GetFileVersionInfoWandVerQueryValueW. I checked the optional header magic independently for each DLL.python -B -m unittest discover -s scripts -p "test_pe_exports.py"passed all 9 tests, with no failures or skips.Windows build 26100, i7-13700, Python 3.14.3. OpenAI Codex (GPT-6) ported the change and ran these read-only checks. No DLL was loaded; the runtime, GPU and game suite were not exercised.
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T05:36:48Z.
Review: COMMENTED
Could header string reads stop at
SizeOfHeadersas well as checking the starting RVA?off()accepts a name RVA inside the headers, butcstr()then scans the entire file for NUL. In the existing PE32 and PE32+ synthetic fixtures, movingHeaderExportto file offset0x3FCwithSizeOfHeaders=0x400still printsHeaderExport: onlyHeadis in the mapped headers and the suffix comes from unrelated.textbytes on disk. Carrying a mapped-region bound intocstr()would reject that name; fixed-width table reads need the same boundary check. Reproduced on exact head30852cf11b086bef9daaf8de3450122d2a0a3068; no DLL was loaded. AI-assisted review with Codex.Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:32:45Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:29:19Z.
Triage (#1607) – head
30852cfNo open PR makes the same change. #2662 (map export RVAs only into file-backed section bytes), #1494 (check NumberOfRvaAndSizes) and #1814 (CLI hardening) change
scripts/re/pe_exports.pydifferently; the shared lines are the synthetic-PE test setup. None of them reads RVAs below SizeOfHeaders.#2662's
raw_spanwould reject header RVAs, so whichever lands second has to keep the header path inoff(). TheSizeOfHeadersoffset (optional header + 60) is right for PE32 and PE32+.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.