Skip to content

otool parser accepts required load-command fields with no value (truncated output becomes null) #1990

Closed

Description

@kaoru0822-kitauji

Observed behavior

parseOtoolLoadCommands (src/native/parsers/otool.ts) accepts truncated otool -l output in which a required load-command field label has no value. It records the field as null instead of rejecting the output as malformed.

#1967 changed requireUniqueField's pattern to ^\s*<key>(?:\s|$) so that a valueless options row in dylib-use commands counts as present. That pattern applies to every required field. parseField still drops a bare label, so the presence check passes while the value is never parsed.

Measured on main 1f17ac822, by cutting one value from the real tests/fixtures/native-macos/otool-load.txt capture:

Required line truncated to its label Result
vmaddr accepted; __TEXT vm_address: null
vmsize accepted; __TEXT vm_size: null
uuid accepted; uuid: null, which reads as "no LC_UUID"
entryoff accepted; entry offset dropped

Before #1967 these were rejected as otool field <key> is missing or repeated. Codex flagged this on #1967 and again on #1972 (P2, "Restrict bare-field matching to empty options"); it is still present on main.

Expected behavior

A required scalar field must appear exactly once and carry a value. Only the dylib-use options row may legitimately be empty. Field-line interpretation should have a single owner (parseField) instead of a second regex.

Activity

  1. added
    bug
    on Oct 11, 2026
  2. added
    area: cli
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: clibug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions