[PR #1995] [MERGED] fix(native): reject required otool fields truncated before their value #4955

Closed
opened 2026-10-31 00:57:19 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1995
Author: @kaoru0822-kitauji
Created: 10/11/2026
Status: ✅ Merged
Merged: 10/12/2026
Merged by: @morluto

Base: main ← Head: fix/issue-1990


📝 Commits (3)

  • 27a4d14 fix(native): reject required otool fields truncated before their value
  • ad89028 fix(native): admit the empty segname of Mach-O object files
  • 4e3cecf fix(native): admit all-NUL Mach-O section names

📊 Changes

2 files changed (+85 additions, -7 deletions)

View changed files

📝 src/native/parsers/otool.ts (+17 -7)
📝 tests/boundary/providers/native/nativeLoadKinds.golden.test.ts (+68 -0)

📄 Description

Fixes #1990

Behavior

#1967 changed requireUniqueField's pattern to ^\s*<key>(?:\s|$), so the empty dylib-use options row counts as present. The pattern applies to every required field. Truncated otool -l output with a bare vmaddr, vmsize, uuid or entryoff label therefore passed the presence check, parseField dropped the line, and the value silently became null. A missing UUID then read as "no LC_UUID". Such output is now rejected with otool field <key> has no value, and an empty options row is still accepted.

requireUniqueField used its own regex to decide which line holds a field. Now parseField, which already owns field-line parsing (including the empty-options exception), decides whether the single matching line carries a value. The label regex is still used only to detect missing or repeated labels, so the existing missing or repeated diagnostics are unchanged.

Validation

  • New cases in tests/boundary/providers/native/nativeLoadKinds.golden.test.ts truncate one required value at a time in the real otool-load.txt capture. All four fail on main (the output is accepted) and pass here. The existing empty-options and repeated-options cases still pass.
  • tests/boundary/providers/native and src/native: 319 passed. The one failure is the local hdiutil verify refusal, which also fails on main on this Mac.
  • npm run lint, npm run typecheck, npm run format:check: pass.
  • npm test: 8,500 passed, 12 failed. These are the same 12 that fail on a clean origin/main worktree on this Mac: ibtool NIB tests, the hdiutil verify refusal, and JS runtime paths under /private/var.
  • Not re-verified against live otool output; the fixture is a real capture.

🤖 Generated with Claude Code


🔄 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/1995 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/11/2026 **Status:** ✅ Merged **Merged:** 10/12/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/issue-1990` --- ### 📝 Commits (3) - [`27a4d14`](https://github.com/morluto/rea/commit/27a4d14a016325fb2b8d0562b491506289da0339) fix(native): reject required otool fields truncated before their value - [`ad89028`](https://github.com/morluto/rea/commit/ad890288aea484b235791cf76f6f2062f3d0cca0) fix(native): admit the empty segname of Mach-O object files - [`4e3cecf`](https://github.com/morluto/rea/commit/4e3cecfddc1faa07d0724eaf5cb3c2e2275f4237) fix(native): admit all-NUL Mach-O section names ### 📊 Changes **2 files changed** (+85 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `src/native/parsers/otool.ts` (+17 -7) 📝 `tests/boundary/providers/native/nativeLoadKinds.golden.test.ts` (+68 -0) </details> ### 📄 Description Fixes #1990 ## Behavior #1967 changed `requireUniqueField`'s pattern to `^\s*<key>(?:\s|$)`, so the empty dylib-use `options` row counts as present. The pattern applies to every required field. Truncated `otool -l` output with a bare `vmaddr`, `vmsize`, `uuid` or `entryoff` label therefore passed the presence check, `parseField` dropped the line, and the value silently became `null`. A missing UUID then read as "no LC_UUID". Such output is now rejected with `otool field <key> has no value`, and an empty `options` row is still accepted. ## Related cleanup `requireUniqueField` used its own regex to decide which line holds a field. Now `parseField`, which already owns field-line parsing (including the empty-`options` exception), decides whether the single matching line carries a value. The label regex is still used only to detect missing or repeated labels, so the existing `missing or repeated` diagnostics are unchanged. ## Validation - New cases in `tests/boundary/providers/native/nativeLoadKinds.golden.test.ts` truncate one required value at a time in the real `otool-load.txt` capture. All four fail on main (the output is accepted) and pass here. The existing empty-`options` and repeated-`options` cases still pass. - `tests/boundary/providers/native` and `src/native`: 319 passed. The one failure is the local hdiutil verify refusal, which also fails on main on this Mac. - `npm run lint`, `npm run typecheck`, `npm run format:check`: pass. - `npm test`: 8,500 passed, 12 failed. These are the same 12 that fail on a clean origin/main worktree on this Mac: ibtool NIB tests, the hdiutil verify refusal, and JS runtime paths under `/private/var`. - Not re-verified against live `otool` output; the fixture is a real capture. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 00:57:19 +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#4955
No description provided.