acphal: AcpHalReleaseShapeContexts takes no argument (RT-ACPHAL-RELEASE) #405

Closed
Kokonotcu wants to merge 1 commit from upstream-pr/405 into main
Kokonotcu commented 2026-11-24 04:44:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kokonotcu on 2026-11-24T04:44:23Z.


Claim: RT-ACPHAL-RELEASE (#14).

What was wrong. The GDK's AcpHalReleaseShapeContexts() has no parameter: it frees what AcpHalAllocateShapeContexts allocated. The shim declared it as AcpHalReleaseShapeContexts(SHAPE_CONTEXTS* ctx = nullptr) and, for a non-null ctx, wrote nullptr into six array pointers through it. A caller passes nothing, so ctx is whatever RCX holds at the call, and six words are written through a stale pointer. In a test that calls it the way the title does (no argument) this showed up as heap corruption, 0xc0000374, in about one run in three; in the title the same writes land in its own memory.

Change. The function takes no argument and only frees its recorded arrays. The caller's structure stays the caller's to clear.

Test. acphal_test now calls it with a stand-in for a stale RCX (a block of 0xAA bytes) and checks the block comes back untouched; before this change the six pointer slots in it were zeroed.

Tested on Windows 10, i7-11800H, RTX 3080 Laptop (no GPU needed): acphal_test passes 10 of 10 repeats under ctest (--repeat until-fail:10), on this branch based on main ece4ba5b3.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5466231062 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/405). Originally posted by [Kokonotcu](https://github.com/Kokonotcu) on 2026-11-24T04:44:23Z. --- Claim: RT-ACPHAL-RELEASE (#14). **What was wrong.** The GDK's `AcpHalReleaseShapeContexts()` has no parameter: it frees what `AcpHalAllocateShapeContexts` allocated. The shim declared it as `AcpHalReleaseShapeContexts(SHAPE_CONTEXTS* ctx = nullptr)` and, for a non-null `ctx`, wrote `nullptr` into six array pointers through it. A caller passes nothing, so `ctx` is whatever RCX holds at the call, and six words are written through a stale pointer. In a test that calls it the way the title does (no argument) this showed up as heap corruption, `0xc0000374`, in about one run in three; in the title the same writes land in its own memory. **Change.** The function takes no argument and only frees its recorded arrays. The caller's structure stays the caller's to clear. **Test.** `acphal_test` now calls it with a stand-in for a stale RCX (a block of `0xAA` bytes) and checks the block comes back untouched; before this change the six pointer slots in it were zeroed. Tested on Windows 10, i7-11800H, RTX 3080 Laptop (no GPU needed): `acphal_test` passes 10 of 10 repeats under ctest (`--repeat until-fail:10`), on this branch based on `main` `ece4ba5b3`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Oliwettoo commented 2026-11-24 10:34:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Oliwettoo on 2026-11-24T10:34:31Z.


The signature fix is right: the GDK reference gives HRESULT AcpHalReleaseShapeContexts() with no parameters (https://devdocs.xbox.com/reference/audio/acphal/functions/acphalreleaseshapecontexts). It also fits docs/audio_hal_exe_calls.md, where the title's one call site loads the handle AcpHalCreate returned into the first argument register, so the old code wrote six nulls into that object. Not built here (Windows-only shim). Nit: the same GDK page lists ACP_E_NOT_ALLOCATED for a release without an allocation, while the test expects S_OK from the second call; that was so before this PR, but may be worth a follow-up. AI-assisted review.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7128962214 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/405#issuecomment-7128962214). Originally posted by [Oliwettoo](https://github.com/Oliwettoo) on 2026-11-24T10:34:31Z. --- The signature fix is right: the GDK reference gives `HRESULT AcpHalReleaseShapeContexts()` with no parameters (https://devdocs.xbox.com/reference/audio/acphal/functions/acphalreleaseshapecontexts). It also fits `docs/audio_hal_exe_calls.md`, where the title's one call site loads the handle `AcpHalCreate` returned into the first argument register, so the old code wrote six nulls into that object. Not built here (Windows-only shim). Nit: the same GDK page lists `ACP_E_NOT_ALLOCATED` for a release without an allocation, while the test expects `S_OK` from the second call; that was so before this PR, but may be worth a follow-up. AI-assisted review.
nicoco23 commented 2026-11-26 16:29:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by nicoco23 on 2026-11-26T16:29:06Z.

Review: COMMENTED


The bug this fixes is real (six pointer writes through an argument the caller never passes), but main already covers it: AcpHalReleaseShapeContexts in runtime/shims/acphal.cpp now takes an unused void* /*hal*/ and writes nothing through it. The only part not on main is the test's stale-RCX check (a 0xAA block that must come back untouched), which would still be a useful regression test on its own. With the conflict and main moved on, it may be simpler to close this and send just that test. AI-assisted review (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6077566078 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/405#pullrequestreview-6077566078). Originally posted by [nicoco23](https://github.com/nicoco23) on 2026-11-26T16:29:06Z. **Review:** COMMENTED --- The bug this fixes is real (six pointer writes through an argument the caller never passes), but main already covers it: `AcpHalReleaseShapeContexts` in `runtime/shims/acphal.cpp` now takes an unused `void* /*hal*/` and writes nothing through it. The only part not on main is the test's stale-RCX check (a 0xAA block that must come back untouched), which would still be a useful regression test on its own. With the conflict and main moved on, it may be simpler to close this and send just that test. AI-assisted review (Claude Code).
MoonEyes commented 2026-11-27 23:19:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-27T23:19:31Z.


Hi @Kokonotcu, thanks for this pull request. It currently conflicts with main (conflicting file(s): runtime/shims/acphal.cpp, runtime/test/acphal_test.cpp), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7230052385 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/405#issuecomment-7230052385). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-27T23:19:31Z. --- Hi @Kokonotcu, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `runtime/shims/acphal.cpp`, `runtime/test/acphal_test.cpp`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
OreoFR commented 2026-11-28 21:42:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:42:37Z.


Verified by OreoFR

  • Base: main c1ecf04ed + PR head c681f78ec
  • Test: not run (merge conflict with main)
  • Red on main: not run
  • Green with the PR: not run
  • Verdict: CONFLICT (conflicts with main in runtime/shims/acphal.cpp and runtime/test/acphal_test.cpp; main already has AcpHalReleaseShapeContexts(void* hal) with the XMA worker stop)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246214727 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/405#issuecomment-7246214727). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T21:42:37Z. --- **Verified by OreoFR** - Base: main `c1ecf04ed` + PR head `c681f78ec` - Test: not run (merge conflict with main) - Red on main: not run - Green with the PR: not run - Verdict: CONFLICT (conflicts with main in runtime/shims/acphal.cpp and runtime/test/acphal_test.cpp; main already has AcpHalReleaseShapeContexts(void* hal) with the XMA worker stop) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-12-01 16:29:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:29:55Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7317706010 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/405#issuecomment-7317706010). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:29:55Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

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
ProjectLeonida/mandy!405
No description provided.