fix(cdb): correct crypt-buffer ownership slot types #1027

Merged
coah80 merged 1 commits from agent/bittle/cdb-buffer-review into main 2026-10-03 02:51:37 +00:00
coah80 commented 2026-10-03 02:49:24 +00:00 (Migrated from github.com)

Source ownership contract

CDBRecord already declares and calls CDBCryptBufAllocate/Free with pointer slots. Correct the definitions from CDBCryptBuf* to CDBCryptBuf**, replacing encoded-pointer reads/writes through buffer32[0] with direct typed slot operations. Allocation state and error behavior are unchanged.

Independent parent verification

  • All three functions remain exact, ctxdiff zero; 296 exact code bytes and 80 data bytes preserved
  • Entire owned object is unchanged; parent comparison of all 1027 allocated objects/relocations and complete report is unchanged
  • Parent compiled the actual production source with ASan/UBSan and passed 50036 ownership transitions, checking pointer-slot canaries, payload preservation, failure state and diagnostics
  • LeakSanitizer disabled because the executor runs under ptrace; this is not a leak-check claim
  • Pool 2/2 and literal checks across three functions pass
  • Full 43U all_source/report/progress/DOL and worktree/diff checks pass

CDBRecord.cryptBuf remains void* with its existing caller casts; that separate shared-header typing is outside this patch. This fixes the definitions' ownership-slot contract, not every cross-unit type. No percentage gain, new matching claim, ABI layout, linking or configuration changes.

Base: 20ba34a80f
Tested tree: 3b9282328b
DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d

No merge performed or requested by this author.

Note

Fix crypt-buffer ownership slot types in CDBCrypt

  • CDBCryptBufAllocate and CDBCryptBufFree now take pointer-to-pointer parameters instead of a crypt-buffer object pointer. Allocation writes the pool entry directly into the caller's slot; free validates the pointed-to entry and clears it to NULL.
  • Removes the obsolete encoding of the slot address into the object's buffer32 field, plus a stale placeholder comment.
  • Adds allhands-cdb-buffer-ownership.attempts.md documenting the fix, build validation, and binary-comparison results.
  • Risk: all callers of CDBCryptBufAllocate/CDBCryptBufFree in CDBCrypt.c must be checked for the new parameter types; invalid pointers still return the existing error result.

Macroscope summarized 7b5bf48.

## Source ownership contract CDBRecord already declares and calls CDBCryptBufAllocate/Free with pointer slots. Correct the definitions from CDBCryptBuf* to CDBCryptBuf**, replacing encoded-pointer reads/writes through buffer32[0] with direct typed slot operations. Allocation state and error behavior are unchanged. ## Independent parent verification - All three functions remain exact, ctxdiff zero; 296 exact code bytes and 80 data bytes preserved - Entire owned object is unchanged; parent comparison of all 1027 allocated objects/relocations and complete report is unchanged - Parent compiled the actual production source with ASan/UBSan and passed 50036 ownership transitions, checking pointer-slot canaries, payload preservation, failure state and diagnostics - LeakSanitizer disabled because the executor runs under ptrace; this is not a leak-check claim - Pool 2/2 and literal checks across three functions pass - Full 43U all_source/report/progress/DOL and worktree/diff checks pass CDBRecord.cryptBuf remains void* with its existing caller casts; that separate shared-header typing is outside this patch. This fixes the definitions' ownership-slot contract, not every cross-unit type. No percentage gain, new matching claim, ABI layout, linking or configuration changes. Base: 20ba34a80f9d0a09c4a8fad51352f0dd97d84be0 Tested tree: 3b9282328bd21fc263fcd41d49658dd04c70cb75 DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d No merge performed or requested by this author. <!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. --> > [!NOTE] > ### Fix crypt-buffer ownership slot types in `CDBCrypt` > - `CDBCryptBufAllocate` and `CDBCryptBufFree` now take pointer-to-pointer parameters instead of a crypt-buffer object pointer. Allocation writes the pool entry directly into the caller's slot; free validates the pointed-to entry and clears it to NULL. > - Removes the obsolete encoding of the slot address into the object's `buffer32` field, plus a stale placeholder comment. > - Adds [allhands-cdb-buffer-ownership.attempts.md](https://github.com/coah80/wii-ipl/pull/1027/files#diff-8ab56bb293557be191341741f3d2472558b137dac3d781a377813ea3b9633713) documenting the fix, build validation, and binary-comparison results. > - Risk: all callers of `CDBCryptBufAllocate`/`CDBCryptBufFree` in [CDBCrypt.c](https://github.com/coah80/wii-ipl/pull/1027/files#diff-076c9920b06f00ca9565b3a3ac54f82eaf8cacb8523b743c365a1e1d2f561d2d) must be checked for the new parameter types; invalid pointers still return the existing error result. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 7b5bf48.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-03 02:51:35 +00:00 (Migrated from github.com)

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.
Sign in to join this conversation.