PE loader: a broken delay-import table fails the load #1199

Open
Longno242 wants to merge 1 commit from upstream-pr/1208 into main
Longno242 commented 2026-11-24 13:15:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Longno242 on 2026-11-24T13:15:14Z.


A malformed delay-import directory only logged a warning and left the module registered (and partially resolved). Normal imports already fail the load and unregister; delay-imports must do the same.

Why hard-fail (stricter than Windows)

  • On Windows a broken delay-import descriptor typically surfaces only when __delayLoadHelper2 first runs that entry; the image can still load.
  • XCL already hard-fails and unregisters on a broken normal import table. Leaving a module registered after delay_imports() fails meant a partially resolved image stayed in the module list with no eager delay resolution — easy to paper over a corrupt directory until a later lazy load, and inconsistent with the normal-import path.
  • Prefer fail-at-load here so titles and tests see the bad PE immediately, matching how we treat other directory parse errors in map_image_ex.

What is in it

  • crates/xcl/src/loader.rs: fail + unregister on delay_imports() error; unit test with a synthetic DLL whose delay Name RVA is outside the image

Tested

  • Hardware/OS (full suite by @jennydeth): 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 959e7a8
  • Commit tested: 959e7a829f2108ebf93c10e5f924f476df4c5549 (clean tree)
  • cargo test --workspace -- --test-threads=4: 742 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)
  • Retail smoke: see Regression run (@Toons29, RX 9070)
  • @DavidM1911 re-checked cargo test -p xcl --lib on RTX 3060 Ti after merging this head with current main locally: all passed, 0 failed, 27 ignored. The PR head itself is unchanged.

Regression run

  • Retail scripts/smoke.ps1 from @Toons29 (RX 9070, 60 s, same title/time; blocks as printed):
xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: 959e7a829f2108ebf93c10e5f924f476df4c5549
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1633 (PresentX 1633)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14812 MB

Not tested

  • Full cargo test --workspace
  • Titles that ship delay-load imports (whether any retail path hits a parse error)

AI use

  • @jennydeth: Claude Code (Claude Opus 5.5) ran the full workspace suite and reported results in a PR comment
  • Cursor Auto (Composer): found the asymmetry vs the import-table failure path, implemented the fix and test, opened this draft PR. Exact underlying model name not disclosed to the agent.
<!-- greyfinch-sync:ivall/xcl:issue:5472853593 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1208). Originally posted by [Longno242](https://github.com/Longno242) on 2026-11-24T13:15:14Z. --- A malformed delay-import directory only logged a warning and left the module registered (and partially resolved). Normal imports already fail the load and unregister; delay-imports must do the same. **Why hard-fail (stricter than Windows)** - On Windows a broken delay-import descriptor typically surfaces only when `__delayLoadHelper2` first runs that entry; the image can still load. - XCL already hard-fails and unregisters on a broken *normal* import table. Leaving a module registered after `delay_imports()` fails meant a partially resolved image stayed in the module list with no eager delay resolution — easy to paper over a corrupt directory until a later lazy load, and inconsistent with the normal-import path. - Prefer fail-at-load here so titles and tests see the bad PE immediately, matching how we treat other directory parse errors in `map_image_ex`. **What is in it** - `crates/xcl/src/loader.rs`: fail + unregister on `delay_imports()` error; unit test with a synthetic DLL whose delay Name RVA is outside the image **Tested** - Hardware/OS (full suite by @jennydeth): 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 959e7a8 - Commit tested: `959e7a829f2108ebf93c10e5f924f476df4c5549` (clean tree) - `cargo test --workspace -- --test-threads=4`: **742 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) - Retail smoke: see **Regression run** (@Toons29, RX 9070) - @DavidM1911 re-checked `cargo test -p xcl --lib` on RTX 3060 Ti after merging this head with current `main` locally: all passed, 0 failed, 27 ignored. The PR head itself is unchanged. **Regression run** - Retail `scripts/smoke.ps1` from @Toons29 (RX 9070, 60 s, same title/time; blocks as printed): ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: 959e7a829f2108ebf93c10e5f924f476df4c5549 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1633 (PresentX 1633) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14812 MB ``` **Not tested** - Full `cargo test --workspace` - Titles that ship delay-load imports (whether any retail path hits a parse error) **AI use** - @jennydeth: Claude Code (Claude Opus 5.5) ran the full workspace suite and reported results in a PR comment - Cursor Auto (Composer): found the asymmetry vs the import-table failure path, implemented the fix and test, opened this draft PR. Exact underlying model name not disclosed to the agent.
DavidM1911 commented 2026-11-24 14:06:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T13:47:22Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib loader: 3 passed, 0 failed.

Note: the full d3d12x lib filter currently aborts with 0xc0000005 on unmodified main too (pre-existing, unrelated to this PR); the PR's own tests were run by name and pass.

<!-- greyfinch-sync:ivall/xcl:comment:7133338948 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1208#issuecomment-7133338948). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T13:47:22Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - cargo test -p xcl --lib loader: 3 passed, 0 failed. Note: the full `d3d12x` lib filter currently aborts with 0xc0000005 on unmodified `main` too (pre-existing, unrelated to this PR); the PR's own tests were run by name and pass.
Toons29 commented 2026-11-25 04:10:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T03:16:11Z.


Regression run of 959e7a82 on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 4178e888, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: 959e7a829f2108ebf93c10e5f924f476df4c5549
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1633 (PresentX 1633)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14812 MB

Against the limits in CONTRIBUTING.md: 101 % of main's frames, 100 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; I checked the blocks before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7151753837 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1208#issuecomment-7151753837). Originally posted by [Toons29](https://github.com/Toons29) on 2026-11-25T03:16:11Z. --- Regression run of `959e7a82` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `4178e888`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: 959e7a829f2108ebf93c10e5f924f476df4c5549 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1633 (PresentX 1633) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14812 MB ``` Against the limits in CONTRIBUTING.md: 101 % of `main`'s frames, 100 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; I checked the blocks before posting.
Longno242 commented 2026-11-25 13:05:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Longno242 on 2026-11-25T12:36:34Z.


Thanks @Toons29 — pasted both of your xcl-smoke v1 blocks under Regression run so the description check can see them.

<!-- greyfinch-sync:ivall/xcl:comment:7162609521 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1208#issuecomment-7162609521). Originally posted by [Longno242](https://github.com/Longno242) on 2026-11-25T12:36:34Z. --- Thanks @Toons29 — pasted both of your `xcl-smoke v1` blocks under **Regression run** so the description check can see them.
Longno242 commented 2026-11-25 13:05:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Longno242 on 2026-11-25T12:43:56Z.


CI is stuck on action_required (first-time contributor workflow approval). Smoke + PR description are green; please approve the pending CI workflow when you get a chance.

<!-- greyfinch-sync:ivall/xcl:comment:7162777933 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1208#issuecomment-7162777933). Originally posted by [Longno242](https://github.com/Longno242) on 2026-11-25T12:43:56Z. --- CI is stuck on `action_required` (first-time contributor workflow approval). Smoke + **PR description** are green; please approve the pending **CI** workflow when you get a chance.
jennydeth commented 2026-11-25 13:05:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by jennydeth on 2026-11-25T13:00:21Z.


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 959e7a8.

Result: cargo test --workspace -- --test-threads=4: 742 passed, 0 failed, 41 ignored. SKIPPED: 2 GPU tests for no wave64 (expected on this card).

Not tested: titles that ship delay-load imports.

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7163156821 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1208#issuecomment-7163156821). Originally posted by [jennydeth](https://github.com/jennydeth) on 2026-11-25T13:00:21Z. --- 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 959e7a8. Result: cargo test --workspace -- --test-threads=4: 742 passed, 0 failed, 41 ignored. SKIPPED: 2 GPU tests for no wave64 (expected on this card). Not tested: titles that ship delay-load imports. AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
Longno242 commented 2026-11-25 14:09:59 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Longno242 on 2026-11-25T13:21:15Z.


Thanks @jennydeth — copied your workspace counts into Tested (742 passed, 0 failed, 41 ignored. SKIPPED: 2 GPU tests for no wave64 (expected on this card)).

<!-- greyfinch-sync:ivall/xcl:comment:7163654230 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1208#issuecomment-7163654230). Originally posted by [Longno242](https://github.com/Longno242) on 2026-11-25T13:21:15Z. --- Thanks @jennydeth — copied your workspace counts into **Tested** (742 passed, 0 failed, 41 ignored. SKIPPED: 2 GPU tests for no wave64 (expected on this card)).
DavidM1911 commented 2026-11-26 04:07:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T03:52:44Z.


Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

<!-- greyfinch-sync:ivall/xcl:comment:7182101451 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1208#issuecomment-7182101451). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T03:52:44Z. --- Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
Longno242 commented 2026-11-26 13:05:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Longno242 on 2026-11-26T12:33:32Z.


Thanks @DavidM1911 — noted the cargo test -p xcl --lib re-check (passed, 0 failed, 27 ignored) under Tested. Head commit is unchanged.

<!-- greyfinch-sync:ivall/xcl:comment:7192157915 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1208#issuecomment-7192157915). Originally posted by [Longno242](https://github.com/Longno242) on 2026-11-26T12:33:32Z. --- Thanks @DavidM1911 — noted the `cargo test -p xcl --lib` re-check (passed, 0 failed, 27 ignored) under **Tested**. Head commit is unchanged.
saintwolf commented 2026-11-30 18:10:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T18:10:54Z.


merge-check claim
head: 959e7a829f

<!-- greyfinch-sync:ivall/xcl:comment:7287467985 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1208#issuecomment-7287467985). Originally posted by [saintwolf](https://github.com/saintwolf) on 2026-11-30T18:10:54Z. --- merge-check claim head: 959e7a829f2108ebf93c10e5f924f476df4c5549
saintwolf commented 2026-11-30 18:23:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T18:23:33Z.


merge-check
base: abec7ce9ee
head: 959e7a829f
merge: clean (trial merge 5e1c7f9b4d3603d8cbe2f3935a126f2e91a3c4e3; git diff --check clean; +33/-1 in crates/xcl/src/loader.rs)
build: cargo build --workspace -> ok (39 lib + 19 test warnings, all pre-existing dead code / deprecations, none from the PR's lines)
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2887 passed, 0 failed, 51 ignored (base + 1 new test; the base abec7ce9 includes #3513's resinfo-D16 test fix, so the previously failing gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16 passes now — this was the only failure on this machine's earlier baseline). SKIPPED: 27, the standard set for this card (22 "no wave64" — wave32-only GPU, 2 "no heap windows", 1 "cannot disable the driver cache (Developer Mode)", 2 "no xgameruntime.dll"). The new a_dll_with_a_broken_delay_import_table_is_not_left_registered passes in the targeted loader run (5/0) and inside the full suite.
review: read the whole diff and the surrounding code. In map_image_ex a parse failure of pe.delay_imports() only logged a warning and continued the load, leaving the mapped module registered; the module's own comment (loader.rs 160-162) promises "a failure from here on takes the module out of the registry again", and the import-table path honours it (unregister + fail) but the delay path did not. The consequence: load_game_dll's idempotency check (find_mapped_by_name) would later return the half-initialised module — delay imports unresolved, module handles not written — as "already loaded", and the address-range lookup would hit it too. The fix makes the delay path identical to the import-table path: unregister_mapped(base) then fail(...). I checked the two helpers: fail frees the mapped memory (VirtualFree MEM_RELEASE) and returns Err, and unregister_mapped removes the module from both the name registry and the lock-free range table (modules.rs:140, documented as Windows' behaviour for a failed DLL), so nothing leaks and no stale entry survives. At the point delay_imports() fails the normal imports have been parsed but not resolved (resolution starts after both parses), so unregistering there is exactly as safe as on the import-table failure. The parser side is already bounded (pe.rs:455-488: at most 4096 descriptors, checked arithmetic, a name RVA outside the image answers BadRva via cstr_at). The test builds a DLL with the existing tiny_dll helper whose delay directory (#13 of 16 data directories, at the helper's computed offset 0x58+0x70+13*8) points at a descriptor with attrs=1 (RVA-based) and Name=0x7FFF0000 outside the image, so the parse errors; it then asserts load_game_dll fails with a "delay-import table" message and find_mapped_by_name is None, over two attempts — the second attempt is what fails under the old behaviour, which would return the still-registered module. The zeroed second descriptor at 0x1030 terminates the parse loop (name_rva == 0 && iat_rva == 0). Thread: DavidM1911 on an RTX 3060 Ti — cargo test -p xcl --lib loader 3/0 at the head merged with current main, plus a re-verification (cargo test -p xcl --lib all passed, 0 failed, 27 ignored); jennydeth on an RTX 3060 — cargo test --workspace 742 passed, 0 failed, 41 ignored, 2 wave64 SKIPPED; Toons29's paired retail xcl-smoke on an RX 9070 (main 4178e888 vs this head: 101% of main's frames, 100% of its peak commit, 0 crashes, 0 device removals). Overlap note: #1367 (open, not in the queue — red CI) "PE: validate directory and table bounds in parser and loader" is complementary, not a duplicate: it hardens the parser (more malformed shapes answer BadRva) and bounds-checks the IAT / module-handle writes in the resolution loop, a different hunk; if it lands first, this PR's error path simply fires for more shapes. No #1607 duplicate group covers #1208. One file, no new dependencies, no stop-criteria files.
performance: none; the success path is unchanged, only the already-failing path now fails and frees its mapping instead of continuing with a half-initialised module registered.
verdict: safe to merge
hardware / tool and model: RTX 4070 SUPER (driver 32.0.16.2140), Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 / OpenCode, Qwen 3.8 27B

<!-- greyfinch-sync:ivall/xcl:comment:7287781548 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1208#issuecomment-7287781548). Originally posted by [saintwolf](https://github.com/saintwolf) on 2026-11-30T18:23:33Z. --- merge-check base: abec7ce9ee2f25efe8c089ca4128ddf171c37afa head: 959e7a829f2108ebf93c10e5f924f476df4c5549 merge: clean (trial merge 5e1c7f9b4d3603d8cbe2f3935a126f2e91a3c4e3; git diff --check clean; +33/-1 in crates/xcl/src/loader.rs) build: cargo build --workspace -> ok (39 lib + 19 test warnings, all pre-existing dead code / deprecations, none from the PR's lines) tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2887 passed, 0 failed, 51 ignored (base + 1 new test; the base abec7ce9 includes #3513's resinfo-D16 test fix, so the previously failing gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16 passes now — this was the only failure on this machine's earlier baseline). SKIPPED: 27, the standard set for this card (22 "no wave64" — wave32-only GPU, 2 "no heap windows", 1 "cannot disable the driver cache (Developer Mode)", 2 "no xgameruntime.dll"). The new a_dll_with_a_broken_delay_import_table_is_not_left_registered passes in the targeted loader run (5/0) and inside the full suite. review: read the whole diff and the surrounding code. In map_image_ex a parse failure of pe.delay_imports() only logged a warning and continued the load, leaving the mapped module registered; the module's own comment (loader.rs 160-162) promises "a failure from here on takes the module out of the registry again", and the import-table path honours it (unregister + fail) but the delay path did not. The consequence: load_game_dll's idempotency check (find_mapped_by_name) would later return the half-initialised module — delay imports unresolved, module handles not written — as "already loaded", and the address-range lookup would hit it too. The fix makes the delay path identical to the import-table path: unregister_mapped(base) then fail(...). I checked the two helpers: fail frees the mapped memory (VirtualFree MEM_RELEASE) and returns Err, and unregister_mapped removes the module from both the name registry and the lock-free range table (modules.rs:140, documented as Windows' behaviour for a failed DLL), so nothing leaks and no stale entry survives. At the point delay_imports() fails the normal imports have been parsed but not resolved (resolution starts after both parses), so unregistering there is exactly as safe as on the import-table failure. The parser side is already bounded (pe.rs:455-488: at most 4096 descriptors, checked arithmetic, a name RVA outside the image answers BadRva via cstr_at). The test builds a DLL with the existing tiny_dll helper whose delay directory (#13 of 16 data directories, at the helper's computed offset 0x58+0x70+13*8) points at a descriptor with attrs=1 (RVA-based) and Name=0x7FFF0000 outside the image, so the parse errors; it then asserts load_game_dll fails with a "delay-import table" message and find_mapped_by_name is None, over two attempts — the second attempt is what fails under the old behaviour, which would return the still-registered module. The zeroed second descriptor at 0x1030 terminates the parse loop (name_rva == 0 && iat_rva == 0). Thread: DavidM1911 on an RTX 3060 Ti — cargo test -p xcl --lib loader 3/0 at the head merged with current main, plus a re-verification (cargo test -p xcl --lib all passed, 0 failed, 27 ignored); jennydeth on an RTX 3060 — cargo test --workspace 742 passed, 0 failed, 41 ignored, 2 wave64 SKIPPED; Toons29's paired retail xcl-smoke on an RX 9070 (main 4178e888 vs this head: 101% of main's frames, 100% of its peak commit, 0 crashes, 0 device removals). Overlap note: #1367 (open, not in the queue — red CI) "PE: validate directory and table bounds in parser and loader" is complementary, not a duplicate: it hardens the parser (more malformed shapes answer BadRva) and bounds-checks the IAT / module-handle writes in the resolution loop, a different hunk; if it lands first, this PR's error path simply fires for more shapes. No #1607 duplicate group covers #1208. One file, no new dependencies, no stop-criteria files. performance: none; the success path is unchanged, only the already-failing path now fails and frees its mapping instead of continuing with a half-initialised module registered. verdict: safe to merge hardware / tool and model: RTX 4070 SUPER (driver 32.0.16.2140), Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 / OpenCode, Qwen 3.8 27B
coolpersonnn commented 2026-11-30 18:33:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by coolpersonnn on 2026-11-30T18:33:48Z.


merge-check claim
head: 959e7a829f

<!-- greyfinch-sync:ivall/xcl:comment:7288032486 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1208#issuecomment-7288032486). Originally posted by [coolpersonnn](https://github.com/coolpersonnn) on 2026-11-30T18:33:48Z. --- merge-check claim head: 959e7a829f2108ebf93c10e5f924f476df4c5549
coolpersonnn commented 2026-11-30 18:39:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by coolpersonnn on 2026-11-30T18:39:15Z.


merge-check
base: abec7ce9ee
head: 959e7a829f
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2887 passed, 0 failed, 51 ignored (25 SKIPPED: 22 no wave64, 2 no heap windows, 1 cannot disable the driver cache); failing: none; new test loader::tests::a_dll_with_a_broken_delay_import_table_is_not_left_registered passed
review: none. Read the full diff (+33/-1 in crates/xcl/src/loader.rs). In map_image_ex, pe.delay_imports() returning Err now unregisters the mapped base and calls fail(...) (freeing the mapping and returning Err), matching pe.imports() right above it before any imports are resolved against the module. The new unit test builds a synthetic DLL with data directory #13 pointing to a delay-import descriptor whose Name RVA is outside the image, runs load_game_dll twice, and verifies both attempts fail with "delay-import table" and leave nothing registered (would fail before the fix, since the old code only logged a warning and kept loading). Minimal scope; no duplicates found in open/merged PRs or #1607.
performance: none (error path during DLL loading only; no hot-path or memory overhead)
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5090 (driver 32.0.16.2101), AMD Ryzen 9 9950X3D, Windows 11 Pro build 26300, Rust 1.100.0 / T3 Code (Antigravity), Gemini 4 Neon (Medium)

<!-- greyfinch-sync:ivall/xcl:comment:7288168119 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1208#issuecomment-7288168119). Originally posted by [coolpersonnn](https://github.com/coolpersonnn) on 2026-11-30T18:39:15Z. --- merge-check base: abec7ce9ee2f25efe8c089ca4128ddf171c37afa head: 959e7a829f2108ebf93c10e5f924f476df4c5549 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2887 passed, 0 failed, 51 ignored (25 SKIPPED: 22 no wave64, 2 no heap windows, 1 cannot disable the driver cache); failing: none; new test loader::tests::a_dll_with_a_broken_delay_import_table_is_not_left_registered passed review: none. Read the full diff (+33/-1 in crates/xcl/src/loader.rs). In map_image_ex, pe.delay_imports() returning Err now unregisters the mapped base and calls fail(...) (freeing the mapping and returning Err), matching pe.imports() right above it before any imports are resolved against the module. The new unit test builds a synthetic DLL with data directory #13 pointing to a delay-import descriptor whose Name RVA is outside the image, runs load_game_dll twice, and verifies both attempts fail with "delay-import table" and leave nothing registered (would fail before the fix, since the old code only logged a warning and kept loading). Minimal scope; no duplicates found in open/merged PRs or #1607. performance: none (error path during DLL loading only; no hot-path or memory overhead) verdict: safe to merge hardware / tool and model: NVIDIA GeForce RTX 5090 (driver 32.0.16.2101), AMD Ryzen 9 9950X3D, Windows 11 Pro build 26300, Rust 1.100.0 / T3 Code (Antigravity), Gemini 4 Neon (Medium)
Foniass commented 2026-12-01 05:07:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:07:39Z.


Triage (#1607) – head 959e7a8

No open or merged PR makes the same change (#1367 bounds the delay-load module-handle write but still only warns when the delay-import table does not parse). One point to consider in loader.rs:map_image_ex: until now a delay-import table that XCL's parser rejects only skipped eager resolution, and the image's own __delayLoadHelper2 thunks still loaded lazily. With this change the whole module fails to load, which is stricter than Windows (it reports a broken delay descriptor only on the first call). The PR description should say why a hard failure is preferred.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7301448109 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1208#issuecomment-7301448109). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:07:39Z. --- **Triage (#1607)** – head 959e7a8 No open or merged PR makes the same change (#1367 bounds the delay-load module-handle write but still only warns when the delay-import table does not parse). One point to consider in loader.rs:map_image_ex: until now a delay-import table that XCL's parser rejects only skipped eager resolution, and the image's own `__delayLoadHelper2` thunks still loaded lazily. With this change the whole module fails to load, which is stricter than Windows (it reports a broken delay descriptor only on the first call). The PR description should say why a hard failure is preferred. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Longno242 commented 2026-12-02 20:47:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Longno242 on 2026-12-02T20:47:23Z.


Updated the description for @Foniass's triage note: why we hard-fail a broken delay-import table at load (same as normal imports) instead of Windows' defer-until-first-helper behavior.

<!-- greyfinch-sync:ivall/xcl:comment:7358318535 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1208#issuecomment-7358318535). Originally posted by [Longno242](https://github.com/Longno242) on 2026-12-02T20:47:23Z. --- Updated the description for @Foniass's triage note: why we hard-fail a broken delay-import table at load (same as normal imports) instead of Windows' defer-until-first-helper behavior.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1208:upstream-pr/1208'
git switch 'upstream-pr/1208'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/1208'
git switch 'upstream-pr/1208'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1208'
git switch 'upstream-pr/1208'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1208'
git switch 'main'
git merge --squash 'upstream-pr/1208'
git switch 'main'
git merge --ff-only 'upstream-pr/1208'
git switch 'main'
git merge 'upstream-pr/1208'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1199
No description provided.