fix(native): reject ambiguous otool load-command framing
Validate Mach command counts, byte totals, scalar uniqueness, section counts, and build-tool counts before claiming exhaustive evidence. Preserve raw output in typed parsing failures and distinguish dylib commands from the dynamic loader. Correct inconsistent handcrafted fixtures and label their provenance. Validation: 38 native tests, combined checks, and temporary-directory hygiene. Multiline dylib-name ambiguity was reproduced with the host Apple otool; regression workflows use captured output and injected command runners.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { expect, it } from "vitest";
|
||||
import { parseOtoolLoadCommands } from "../../../../src/native/parsers/otool.js";
|
||||
import { nativeFixture } from "../../../fixtures/nativeCommands.js";
|
||||
import {
|
||||
nativeFixture,
|
||||
withOtoolMachHeader,
|
||||
} from "../../../fixtures/nativeCommands.js";
|
||||
it.each([
|
||||
["decimal-space", "123 library.dylib"],
|
||||
["hex-space", "0x123 library.dylib"],
|
||||
@@ -9,7 +12,9 @@ it.each([
|
||||
["ordinary", "ordinary.dylib"],
|
||||
])("preserves native install-name text from %s capture", async (slug, name) => {
|
||||
const load = parseOtoolLoadCommands(
|
||||
await nativeFixture(`load-command-text-values/${slug}.txt`),
|
||||
withOtoolMachHeader(
|
||||
await nativeFixture(`load-command-text-values/${slug}.txt`),
|
||||
),
|
||||
);
|
||||
expect(load.dependencies).toContainEqual({
|
||||
path: name,
|
||||
|
||||
Reference in New Issue
Block a user