[PR #4119] [CLOSED] fix(native): record an empty Objective-C category name as a category failure #6069

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4119
Author: @Totopo27
Created: 10/15/2026
Status: ❌ Closed

Base: main ← Head: fix/4115-objc-category-empty-name


📝 Commits (1)

  • 01a87dd fix(native): record an empty Objective-C category name as a category failure

📊 Changes

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

View changed files

📝 src/native/AppleDispatchMetadata.test.ts (+37 -2)
📝 src/native/AppleObjcCategories.ts (+2 -0)

📄 Description

Summary

Fixes #4115. Records an Objective-C category with an empty name as a per-record decoding failure (category_decode_failed) rather than propagating the unvalidated string into the final schema parse. This preserves valid class siblings and other metadata decoded from the same Mach-O image.

Problem and expected behavior

When a Mach-O's __objc_catlist contains a category record with an empty (NUL-only) name, read.string(read.pointer(category)) produces "". Because objcCategorySchema requires name: z.string().min(1), this empty string sailed past the category decoding loop and detonated during whole-result objcSwiftMetadataSchema.parse with a ZodError. As a result, the entire dispatch metadata inspection aborted and valid classes decoded from the image were discarded.

Expected behavior: Mirror the protocol handling (#3873 / #4078). An empty category name throws inside the per-category try/catch boundary, recording a category_decode_failed issue under objc_properties_categories, marking that facet partial, and retaining valid sibling classes.

Change and scope

  • Added if (name.length === 0) throw new TypeError("Objective-C category has an empty name"); in src/native/AppleObjcCategories.ts.
  • Added unit regression test in src/native/AppleDispatchMetadata.test.ts.

Ordinary fix within existing boundaries; contribution scope fit is not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/native/AppleObjcCategories.ts (Native inspection / Apple dispatch metadata).
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: Mach-O Objective-C category parsing.
  • Evidence, artifact, provenance, or reconstruction contract: partial facet coverage preserved with explicit issue reason.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): none.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: src/native/AppleDispatchMetadata.test.ts ("keeps the class when an Objective-C category name is empty").
  • Base reproduction or other evidence: On base revision without the fix, decoding an image with an empty category name fails during schema parse and discards classes.
  • User-visible CLI/MCP output (if applicable): not applicable.
  • Remaining proof gaps: none.

For evidence-bearing changes:

  • 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

  • npm run check:fast — passed (typecheck and lint via turbo).
  • npm run test:focused -- src/native/AppleDispatchMetadata.test.ts — passed (43 tests passed).
  • npm run test:local -- src/native/AppleDispatchMetadata.test.ts — passed (43 tests passed).

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: Mach-O binary parsing.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner: @Totopo27

  • 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/4119 **Author:** [@Totopo27](https://github.com/Totopo27) **Created:** 10/15/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/4115-objc-category-empty-name` --- ### 📝 Commits (1) - [`01a87dd`](https://github.com/morluto/rea/commit/01a87dd4a7ab03cc6b95a4496731d30f8dd580c5) fix(native): record an empty Objective-C category name as a category failure ### 📊 Changes **2 files changed** (+39 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/native/AppleDispatchMetadata.test.ts` (+37 -2) 📝 `src/native/AppleObjcCategories.ts` (+2 -0) </details> ### 📄 Description ## Summary Fixes #4115. Records an Objective-C category with an empty name as a per-record decoding failure (`category_decode_failed`) rather than propagating the unvalidated string into the final schema parse. This preserves valid class siblings and other metadata decoded from the same Mach-O image. ## Problem and expected behavior When a Mach-O's `__objc_catlist` contains a category record with an empty (NUL-only) name, `read.string(read.pointer(category))` produces `""`. Because `objcCategorySchema` requires `name: z.string().min(1)`, this empty string sailed past the category decoding loop and detonated during whole-result `objcSwiftMetadataSchema.parse` with a `ZodError`. As a result, the entire dispatch metadata inspection aborted and valid classes decoded from the image were discarded. Expected behavior: Mirror the protocol handling (#3873 / #4078). An empty category name throws inside the per-category `try/catch` boundary, recording a `category_decode_failed` issue under `objc_properties_categories`, marking that facet partial, and retaining valid sibling classes. ## Change and scope - Added `if (name.length === 0) throw new TypeError("Objective-C category has an empty name");` in `src/native/AppleObjcCategories.ts`. - Added unit regression test in `src/native/AppleDispatchMetadata.test.ts`. Ordinary fix within existing boundaries; contribution scope fit is not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: `src/native/AppleObjcCategories.ts` (Native inspection / Apple dispatch metadata). - Contribution scope fit and linked maintainer decision: not applicable. - CLI and MCP/tool-catalog contract: none. - Provider, bridge, target-format, or platform compatibility: Mach-O Objective-C category parsing. - Evidence, artifact, provenance, or reconstruction contract: partial facet coverage preserved with explicit issue reason. - Target selection, authority, upstream behavior, and cleanup details (if applicable): none. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: none. Expected effects: - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: `src/native/AppleDispatchMetadata.test.ts` ("keeps the class when an Objective-C category name is empty"). - Base reproduction or other evidence: On base revision without the fix, decoding an image with an empty category name fails during schema parse and discards classes. - User-visible CLI/MCP output (if applicable): not applicable. - Remaining proof gaps: none. For evidence-bearing changes: - [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 - `npm run check:fast` — passed (typecheck and lint via turbo). - `npm run test:focused -- src/native/AppleDispatchMetadata.test.ts` — passed (43 tests passed). - `npm run test:local -- src/native/AppleDispatchMetadata.test.ts` — passed (43 tests passed). ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: Mach-O binary parsing. - Package or release metadata impact: none. - Security, privacy, process, or containment review: none. ## Author readiness Human owner: @Totopo27 - [ ] 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:11:36 +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#6069
No description provided.