[PR #4545] [CLOSED] fix(objc): isolate empty Objective-C ivar names #6298

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4545
Author: @Iyanuoluwa007
Created: 10/16/2026
Status: ❌ Closed

Base: main ← Head: fix/objc-empty-ivar-name


📝 Commits (1)

  • 770f0d1 fix(objc): isolate empty Objective-C ivar names

📊 Changes

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

View changed files

📝 src/native/AppleDispatchMetadata.test.ts (+33 -0)
📝 src/native/AppleObjcDispatchFacets.ts (+10 -1)

📄 Description

Summary

Fixes #4533. An Objective-C ivar record whose name pointer reaches an empty string no longer aborts decodeAppleDispatchMetadata. The empty entry is reported as a class decode failure and skipped; the class, its other ivars, and every other class, protocol and category keep their records.

Problem and expected behavior

readClass appended read.string(read.pointer(entry + 8n)) to objc_ivars without checking length. objcIvarSchema requires name.min(1), so the final objcSwiftMetadataSchema.parse threw a ZodError after all per-class recovery had already run, discarding the whole result. Class, protocol and property names already reject empty names inside their own record boundary; ivars did not.

Change and scope

src/native/AppleObjcDispatchFacets.ts: read the ivar name first; when empty, push Objective-C ivar <index> of <class> at <address> has an empty name to failures and continue. The declared ivar_count is unchanged (it reports the list header count). Entry-level isolation matches readObjcPropertyList, so a sibling ivar after the malformed one survives.

Not included: empty method selectors (#4534), handled separately.

Contract and boundary impact

  • Semantic owner and earliest changed stage: Objective-C class/ivar decode facet.

  • Contribution scope fit and linked maintainer decision: not applicable (ordinary fix within existing boundary).

  • CLI and MCP/tool-catalog contract: none.

  • Provider, bridge, target-format, or platform compatibility: none.

  • Evidence, artifact, provenance, or reconstruction contract: objc_class_method_ivar_metadata coverage becomes partial with the failure reason instead of the operation throwing.

  • 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 "reports an empty ivar name without discarding the class or its other ivars". The fixture's ivar list has two entries; the first names an empty string, the second is the valid state ivar.

  • Base reproduction: with the source change stashed, the new test fails with ZodError ... "code": "too_small" (executed). With the change, it passes.

  • Remaining proof gaps: synthetic in-memory Mach-O only; no real-world binary with an empty ivar name was examined.

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npx vitest run src/native/AppleDispatchMetadata.test.ts with the fix stashed: the new test fails with ZodError (too_small).
  • npx vitest run src/native/: 17 files, 278 tests passed.
  • npm run check:fast (typecheck, lint): 2 tasks successful.
  • Pre-commit hook (oxfmt, oxlint --fix): passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; Windows x64, Node 22.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: reads bytes only.

Author readiness

Human owner: @Iyanuoluwa007

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 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/4545 **Author:** [@Iyanuoluwa007](https://github.com/Iyanuoluwa007) **Created:** 10/16/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/objc-empty-ivar-name` --- ### 📝 Commits (1) - [`770f0d1`](https://github.com/morluto/rea/commit/770f0d1cac9a594d487196f0117398f75f46de23) fix(objc): isolate empty Objective-C ivar names ### 📊 Changes **2 files changed** (+43 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/native/AppleDispatchMetadata.test.ts` (+33 -0) 📝 `src/native/AppleObjcDispatchFacets.ts` (+10 -1) </details> ### 📄 Description ## Summary Fixes #4533. An Objective-C ivar record whose name pointer reaches an empty string no longer aborts `decodeAppleDispatchMetadata`. The empty entry is reported as a class decode failure and skipped; the class, its other ivars, and every other class, protocol and category keep their records. ## Problem and expected behavior `readClass` appended `read.string(read.pointer(entry + 8n))` to `objc_ivars` without checking length. `objcIvarSchema` requires `name.min(1)`, so the final `objcSwiftMetadataSchema.parse` threw a `ZodError` after all per-class recovery had already run, discarding the whole result. Class, protocol and property names already reject empty names inside their own record boundary; ivars did not. ## Change and scope `src/native/AppleObjcDispatchFacets.ts`: read the ivar name first; when empty, push `Objective-C ivar <index> of <class> at <address> has an empty name` to `failures` and `continue`. The declared `ivar_count` is unchanged (it reports the list header count). Entry-level isolation matches `readObjcPropertyList`, so a sibling ivar after the malformed one survives. Not included: empty method selectors (#4534), handled separately. ## Contract and boundary impact - Semantic owner and earliest changed stage: Objective-C class/ivar decode facet. - Contribution scope fit and linked maintainer decision: not applicable (ordinary fix within existing boundary). - CLI and MCP/tool-catalog contract: none. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: `objc_class_method_ivar_metadata` coverage becomes `partial` with the failure reason instead of the operation throwing. - 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` "reports an empty ivar name without discarding the class or its other ivars". The fixture's ivar list has two entries; the first names an empty string, the second is the valid `state` ivar. - Base reproduction: with the source change stashed, the new test fails with `ZodError ... "code": "too_small"` (executed). With the change, it passes. - Remaining proof gaps: synthetic in-memory Mach-O only; no real-world binary with an empty ivar name was examined. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npx vitest run src/native/AppleDispatchMetadata.test.ts` with the fix stashed: the new test fails with `ZodError` (too_small). - `npx vitest run src/native/`: 17 files, 278 tests passed. - `npm run check:fast` (typecheck, lint): 2 tasks successful. - Pre-commit hook (oxfmt, oxlint --fix): passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: not applicable; Windows x64, Node 22. - Package or release metadata impact: none. - Security, privacy, process, or containment review: reads bytes only. ## Author readiness Human owner: @Iyanuoluwa007 - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:13:23 +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#6298
No description provided.