HLE: guard dialog commands before initialization #1515

Manually merged
github merged 1 commit from gh-pr/1515/head into gh-pr/1515/base 2026-11-26 04:34:41 +00:00
Owner

@⁠Calvix2k on GitHub · 2026-11-24 18:40 UTC · original
Calvix2k:codex/ui-dialog-command-guard-033 → main · +18 −1 · 1 files · 1 commits · merged 2026-11-25 00:14 UTC

Summary

Fixes VIC-BT-033 from audit issue #1242.

The dialog procedure handled WM_COMMAND by immediately turning GWLP_USERDATA into a mutable Entry reference. If a command arrives before WM_INITDIALOG has stored the entry pointer, this dereferences null. The procedure now ignores commands while user data is unset.

A Windows regression test invokes the command handler before initialization and verifies it safely returns without handling the command.

Verification

  • cargo test -p victory-hle --lib --locked — 95 passed
  • cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings — clean
  • cargo xtask policy --staged — passed
  • git diff --check — passed

A file-specific rustfmt --check reports pre-existing formatting differences elsewhere in xgameui.rs; no unrelated formatting changes are included.

**@⁠Calvix2k** on GitHub · 2026-11-24 18:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1515) `Calvix2k:codex/ui-dialog-command-guard-033` → `main` · +18 −1 · 1 files · 1 commits · merged 2026-11-25 00:14 UTC ## Summary Fixes `VIC-BT-033` from audit issue #1242. The dialog procedure handled `WM_COMMAND` by immediately turning `GWLP_USERDATA` into a mutable `Entry` reference. If a command arrives before `WM_INITDIALOG` has stored the entry pointer, this dereferences null. The procedure now ignores commands while user data is unset. A Windows regression test invokes the command handler before initialization and verifies it safely returns without handling the command. ## Verification - `cargo test -p victory-hle --lib --locked` — 95 passed - `cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings` — clean - `cargo xtask policy --staged` — passed - `git diff --check` — passed A file-specific `rustfmt --check` reports pre-existing formatting differences elsewhere in `xgameui.rs`; no unrelated formatting changes are included.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:34:39 +00:00
github manually merged commit 9ccb83c00a into gh-pr/1515/base 2026-11-26 04:34:41 +00:00
Author
Owner

@⁠acetonahard-code on GitHub · 2026-11-24 22:30 UTC · original

Heads-up: #1373 (opened about an hour earlier) adds the same check. dialog::procedure returns early on a zero GWLP_USERDATA in WM_COMMAND. The two conflict in xgameui.rs.

Tested on Windows 11 with the repo toolchain, merged into current main (70564ae):

cargo test -p victory-hle passed failed ignored
main 99 0 0
main + this PR 100 0 0
  • The new test passes.
  • cargo clippy --all-targets -- -D warnings, with and without --all-features: clean.

I didn't test with game data.


Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.

**@⁠acetonahard-code** on GitHub · 2026-11-24 22:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/1515#issuecomment-7146309421) Heads-up: #1373 (opened about an hour earlier) adds the same check. `dialog::procedure` returns early on a zero `GWLP_USERDATA` in `WM_COMMAND`. The two conflict in `xgameui.rs`. Tested on Windows 11 with the repo toolchain, merged into current `main` (70564ae): | `cargo test -p victory-hle` | passed | failed | ignored | |---|---|---|---| | `main` | 99 | 0 | 0 | | `main` + this PR | 100 | 0 | 0 | - The new test passes. - `cargo clippy --all-targets -- -D warnings`, with and without `--all-features`: clean. I didn't test with game data. --- <sub>Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.</sub>
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 00:41 UTC · original

Heads-up acknowledged. #1373 is now closed, so this PR is the surviving fix for the null GWLP_USERDATA case in XGameUi. The xgameui.rs conflict is therefore moot; this one is mergeable and should be the one to take.

**@⁠Calvix2k** on GitHub · 2026-11-25 00:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/1515#issuecomment-7148778014) Heads-up acknowledged. #1373 is now closed, so this PR is the surviving fix for the null GWLP_USERDATA case in XGameUi. The xgameui.rs conflict is therefore moot; this one is mergeable and should be the one to take.
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1515
No description provided.