[PR #3239] [CLOSED] fix(native): decode the Objective-C ivar word-alignment sentinel #5668

Closed
opened 2026-10-31 01:08:27 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3239
Author: @arlandev
Created: 10/14/2026
Status: ❌ Closed

Base: main ← Head: fix/objc-ivar-word-alignment-sentinel


📝 Commits (1)

  • 739c682 fix(native): decode the Objective-C ivar word-alignment sentinel

📊 Changes

2 files changed (+20 additions, -1 deletions)

View changed files

📝 src/native/AppleDispatchMetadata.test.ts (+13 -0)
📝 src/native/AppleObjcDispatchFacets.ts (+7 -1)

📄 Description

Summary

Fixes #3186.

inspect-native-dispatch-metadata returned alignment: null for an Objective-C ivar whose raw alignment is 0xffffffff. objc4's ivar_t::alignment() defines that value as word alignment (1 << WORD_SHIFT), so the decoder now reports 8 for it.

Problem and expected behavior

The ivar decoder converted raw alignment exponents below 31 to 2 ** raw and returned null for everything else, with no case for the ~0 sentinel. The record still reported decode.status: decoded, so a defined layout fact was dropped silently.

Expected (from the issue): the sentinel gives 8, ordinary exponent 3 gives 8, and the invalid non-sentinel 0xfffffffe stays null.

Change and scope

One branch in decodeObjcDispatchFacets (src/native/AppleObjcDispatchFacets.ts): 0xffffffff maps to 8. The decoder already rejects ivar entries whose stride is not 32 bytes, which is the 64-bit ivar_t layout, so the word size is always 8 here. Other values are unchanged, and values of 31 or more other than the sentinel remain null.

Contribution scope: ordinary fix within existing boundaries, so no maintainer scope decision is needed.

Contract and boundary impact

  • Semantic owner and earliest changed stage: decodeObjcDispatchFacets, ivar record construction.

  • Contribution scope fit and linked maintainer decision: not applicable (bug fix within existing static-metadata decoding).

  • CLI and MCP/tool-catalog contract: none. alignment is already a positive integer or null; this only fills a value that was wrongly null.

  • Provider, bridge, target-format, or platform compatibility: native-macos metadata reader only; 64-bit Mach-O ivar lists, which are already the only accepted layout.

  • Evidence, artifact, provenance, or reconstruction contract: none.

  • Target selection, authority, upstream behavior, and cleanup details: not applicable.

  • Generated metadata, package, or installation impact: none.

  • Read existing files or captured data.

Evidence and regression coverage

  • Tests added or updated: src/native/AppleDispatchMetadata.test.ts adds a parameterized case that sets the fixture ivar's raw alignment to 0xffffffff, 3, and 0xfffffffe and expects 8, 8, and null, each with decode.status: decoded.
  • Base reproduction or other evidence: executed. On the base revision the 0xffffffff case fails (receives null); the other two pass. All three pass with the fix.
  • User-visible CLI/MCP output: objc_ivars[].alignment is 8 instead of null for the sentinel.
  • Remaining proof gaps: the issue's end-to-end CLI reproduction against a built runtime was not rerun; coverage is the source-level decoder test.

Validation performed

  • npm run test:local -- src/native/AppleDispatchMetadata.test.ts: 36 passed.
  • Same command with the source fix reverted: only decodes ivar alignment raw value 4294967295 as 8 fails.
  • npm run check:fast: typecheck and lint pass.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable (pure decoder change); tests run on macOS arm64.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no target execution or new I/O.

🔄 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/morluto/rea/pull/3239 **Author:** [@arlandev](https://github.com/arlandev) **Created:** 10/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/objc-ivar-word-alignment-sentinel` --- ### 📝 Commits (1) - [`739c682`](https://github.com/morluto/rea/commit/739c68262389f3d6fe2ca314090400cbaae2de1b) fix(native): decode the Objective-C ivar word-alignment sentinel ### 📊 Changes **2 files changed** (+20 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/native/AppleDispatchMetadata.test.ts` (+13 -0) 📝 `src/native/AppleObjcDispatchFacets.ts` (+7 -1) </details> ### 📄 Description ## Summary Fixes #3186. `inspect-native-dispatch-metadata` returned `alignment: null` for an Objective-C ivar whose raw alignment is `0xffffffff`. objc4's `ivar_t::alignment()` defines that value as word alignment (`1 << WORD_SHIFT`), so the decoder now reports `8` for it. ## Problem and expected behavior The ivar decoder converted raw alignment exponents below 31 to `2 ** raw` and returned `null` for everything else, with no case for the `~0` sentinel. The record still reported `decode.status: decoded`, so a defined layout fact was dropped silently. Expected (from the issue): the sentinel gives `8`, ordinary exponent 3 gives `8`, and the invalid non-sentinel `0xfffffffe` stays `null`. ## Change and scope One branch in `decodeObjcDispatchFacets` (`src/native/AppleObjcDispatchFacets.ts`): `0xffffffff` maps to `8`. The decoder already rejects ivar entries whose stride is not 32 bytes, which is the 64-bit `ivar_t` layout, so the word size is always 8 here. Other values are unchanged, and values of 31 or more other than the sentinel remain `null`. Contribution scope: ordinary fix within existing boundaries, so no maintainer scope decision is needed. ## Contract and boundary impact - Semantic owner and earliest changed stage: `decodeObjcDispatchFacets`, ivar record construction. - Contribution scope fit and linked maintainer decision: not applicable (bug fix within existing static-metadata decoding). - CLI and MCP/tool-catalog contract: none. `alignment` is already a positive integer or null; this only fills a value that was wrongly null. - Provider, bridge, target-format, or platform compatibility: native-macos metadata reader only; 64-bit Mach-O ivar lists, which are already the only accepted layout. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details: not applicable. - Generated metadata, package, or installation impact: none. - [x] Read existing files or captured data. ## Evidence and regression coverage - Tests added or updated: `src/native/AppleDispatchMetadata.test.ts` adds a parameterized case that sets the fixture ivar's raw alignment to `0xffffffff`, `3`, and `0xfffffffe` and expects `8`, `8`, and `null`, each with `decode.status: decoded`. - Base reproduction or other evidence: executed. On the base revision the `0xffffffff` case fails (receives `null`); the other two pass. All three pass with the fix. - User-visible CLI/MCP output: `objc_ivars[].alignment` is `8` instead of `null` for the sentinel. - Remaining proof gaps: the issue's end-to-end CLI reproduction against a built runtime was not rerun; coverage is the source-level decoder test. ## Validation performed - `npm run test:local -- src/native/AppleDispatchMetadata.test.ts`: 36 passed. - Same command with the source fix reverted: only `decodes ivar alignment raw value 4294967295 as 8` fails. - `npm run check:fast`: typecheck and lint pass. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: not applicable (pure decoder change); tests run on macOS arm64. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no target execution or new I/O. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:08:27 +00:00
Sign in to join this conversation.
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
morluto/rea#5668
No description provided.