Skip to content

fix(apple): preserve leading U+FEFF in load-command strings - #2434

Closed
Aurantium-47 wants to merge 1 commit into
morluto:mainfrom
Aurantium-47:fix/macho-leading-feff
Closed

Aurantium-47 wants to merge 1 commit into
morluto:mainfrom
Aurantium-47:fix/macho-leading-feff

Conversation

@Aurantium-47

@Aurantium-47 Aurantium-47 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Withdrawn as a duplicate of #2110. That earlier PR already applies the same ignoreBOM: true correction to the Mach-O load-command decoder and covers it with parser and CLI regressions. My earlier duplicate check missed it; closing this PR to avoid duplicating the existing work.


Summary

Preserve a leading U+FEFF in Mach-O load-command strings. A dependency spelled \uFEFF@rpath/libcore.dylib was being read as @rpath/libcore.dylib, which could make trace-dylib-resolution report a successful match to a different name.

Problem and expected behavior

TextDecoder removes an initial UTF-8 BOM by default. An lc_str is an embedded NUL-terminated pathname or environment string, so those bytes belong to its value. Apple's format definition requires matching library pathnames. This source-discovered bug has no linked issue; related issues and PRs were checked before implementation.

Change and scope

Set ignoreBOM: true in the existing commandString decoder. The same owner serves dylib IDs and dependencies, rpaths, and embedded dyld environment strings. Fatal UTF-8 validation remains enabled. This is an ordinary static-inspection fix within existing scope; advance maintainer scope approval is not applicable.

Contract and boundary impact

  • Owner: Mach-O load-command string decoding, before dependency resolution.
  • CLI/MCP: existing schemas and commands remain unchanged; reported string values retain their original leading character.
  • Evidence: no renamed dependency or invented successful match; original artifact identity remains unchanged.
  • Target effects: existing local files are read. No target execution, mutation, network access, provider, packaging, or generated-metadata change.

Evidence and regression coverage

  • A reader regression covers all five affected command encodings/fields and fails on the base revision; all 26 prior reader tests pass there.
  • A compiled public CLI regression contrasts both spellings in the same generated Mach-O bundle. With the fix, the prefixed name is retained with undetermined resolution because its runtime-relative base is unknown. The ordinary @rpath name still resolves to Contents/Frameworks/libcore.dylib.

Validation performed

  • Reader and applicable CLI cases: 36 passed. The host is Windows; two existing cases requiring symlink privileges or POSIX chmod(000) semantics were excluded from that selection.
  • npm run check — six tasks and architecture guards passed, with no lint errors.
  • npm run verify:test-discovery — all 1,004 test files discovered exactly once.
  • git diff --check — passed.

The fixtures exercise REA's actual static CLI, not dyld execution or a disassembler engine. No new real-provider capability is claimed.

Before merge

  • Focused source fix with failing-before regression and public CLI coverage.
  • Original bytes, uncertainty, and existing malformed-input behavior preserved.
  • No contract, generated metadata, package, or migration changes required.
  • Final diff checked for unrelated changes and credentials.

AI assistance: OpenAI GPT-6 assisted with implementation and verification.

Assisted-by: OpenAI GPT-6 <noreply@openai.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@morluto morluto added the bug Something isn't working label Oct 14, 2026
@morluto

morluto commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Thanks @Aurantium-47 for identifying that a leading U+FEFF can be meaningful content in Mach-O load-command strings. That diagnosis helped make the decoder’s content-preservation requirement clear; main already had the equivalent fix from #2110 (main).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants