[PR #405] acphal: AcpHalReleaseShapeContexts takes no argument (RT-ACPHAL-RELEASE) #455

Open
opened 2026-11-26 20:17:56 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/405
Author: @Kokonotcu
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: pr/acphal-release-abi


📝 Commits (1)

  • c681f78 acphal: AcpHalReleaseShapeContexts takes no argument (RT-ACPHAL-RELEASE)

📊 Changes

2 files changed (+14 additions, -14 deletions)

View changed files

📝 runtime/shims/acphal.cpp (+5 -10)
📝 runtime/test/acphal_test.cpp (+9 -4)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/405 **Author:** [@Kokonotcu](https://github.com/Kokonotcu) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `pr/acphal-release-abi` --- ### 📝 Commits (1) - [`c681f78`](https://github.com/ubiquitarianism/leonida/commit/c681f78ecab6a960d3ab97ba72b7d3c1984def9d) acphal: AcpHalReleaseShapeContexts takes no argument (RT-ACPHAL-RELEASE) ### 📊 Changes **2 files changed** (+14 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/acphal.cpp` (+5 -10) 📝 `runtime/test/acphal_test.cpp` (+9 -4) </details> ### 📄 Description 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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
starred/leonida#455
No description provided.