PE loader: skip export ordinals past u32::MAX (#691) #695
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/700"
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 towiice on 2026-11-24T03:47:47Z.
Fixes #691.
OwnedExports::from_peadded the export directory'sBase(read from the file) to each function index with plainu32addition. ABasenearu32::MAXpanicked on overflow in debug builds and wrapped to low ordinals in release builds, where the entry could shadow a real ordinal. The entry pastu32::MAXhas no ordinal, so it is now skipped (checked_add,break, since every later index overflows too). This is the fix proposed in #691; the test is the one from the issue, which I reran.What is in it
crates/xcl/src/pe.rs:checked_addfor the ordinal inOwnedExports::from_pe, plus the unit testexport_ordinals_past_u32_max_are_skipped.Tested
x86_64-pc-windows-gnullvm(llvm-mingw 20261117), debugattempt to add with overflow) and passes with itcargo build --workspacethencargo test --workspace --no-fail-fast -- --test-threads=4: 702 passed, 0 failed, 41 ignoredAlso tested by others
Regression run
Not made by me (I have no title). Anon64 made both runs with
scripts/smoke.ps1, same title and time, and posted them in a comment on this PR for this section; they are pasted unedited (RTX 3060, driver 581.80). Themainrun is oncb868b2, the base of this PR.main:
PR:
Not tested
AI use
Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-24T07:01:24Z.
Regression runs for this PR's head
95aab05and for its basemaincb868b2, on a retail title (same title, 60 s each), made withscripts/smoke.ps1(release, clean tree at each commit) and pasted unedited, for Regression run.main:
this PR:
Tested
Not tested
Report written with Claude Code (Claude Opus 5.5) from runs on this machine.
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T07:06:00Z.
Full-suite run to go with the smoke runs above, so the new test has a result on hardware. Tested exact head
95aab05(on its basecb868b2).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 686 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.export_ordinals_past_u32_max_are_skipped.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T11:54:27Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
upstream-sync referenced this pull request2026-11-25 16:10:51 +00:00
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:42:03Z.
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-01T03:58:16Z.
Triage (#1607) – head
95aab05#1534 made the same checked add on the ordinal and was closed as a duplicate of this PR. Main still computes
ex.ordinal_base + i as u32inOwnedExports::from_pe.No problems found in the diff; the test overflows the add (base u32::MAX, two functions), so it fails without the fix in a debug build.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by BBareth on 2026-12-01T09:38:50Z.
merge-check claim
head:
95aab05e91Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T09:44:46Z.
merge-check claim
head:
95aab05e91Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T09:46:50Z.
merge-check claim
head:
95aab05e91Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T09:59:11Z.
merge-check
base:
493dbd3dd0head:
95aab05e91merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2900 passed, 1 failed, 51 ignored; 29 SKIPPED lines
failing: test_title_runs_and_game_folder_is_untouched
review: automated overnight check — diff inspected for safety only (no build/CI/toolchain/script changes, no process/network/runtime-loading code); no duplicate search performed; no line-by-line code review.
performance: not assessed beyond the suite.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 610.88 (32.0.16.1088); Ryzen 7 5800X3D, 64 GB; Windows 11 22631; OpenCode agent, DeepSeek V4.1 Flash 1017
Imported from ivall/xcl. Originally posted by BBareth on 2026-12-01T09:59:57Z.
merge-check
base:
493dbd3dd0head:
95aab05e91merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2901 passed, 0 failed, 51 ignored; 28 SKIPPED lines, as on the base; failing: none. The base alone, same machine, same commit: 2900 passed, 0 failed, 51 ignored, 28 SKIPPED lines (22 no wave64, 2 no heap windows, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 cannot disable the driver cache). The new test
export_ordinals_past_u32_max_are_skippedran and passed.review: no blocking finding; one file (+22/-1), every line read.
OwnedExports::from_pecomputes each ordinal withchecked_addand stops at the first one pastu32::MAX(every later index overflows too), where a debug build panicked and a release build wrapped to ordinal 0. For a well-formed image nothing changes. The test builds an export directory with baseu32::MAXand two functions and checks that only the first is kept. Not tested here: nothing further; this is parser hardening for malformed images.performance: none: one checked addition per export.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124); i7-12700K; Windows 11 26200. Claude Code, Claude Fable 5.2 read the diff, ran the build and the suite and wrote this check.
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.