Files
reverse-engineering-anything/src/native/AppleMachoNames.ts
T
morluto 9d4293be27 fix(apple): preserve byte identity in metadata names
Use one lossless Mach-O name projection for symbols and dependency paths, retaining undecodable bytes and partial binding facts. Keep referenced NIB string failures unknown and preserve their source nodes through the shared lazy projection. Valid Unicode, readable sibling metadata and weak-bind scope remain usable.

Exercise the producer and CLI/MCP consumers, and align date-overlap and object-capacity fixtures with their owning archive contracts without relaxing admission or omission assertions.
2026-10-24 08:30:40 +08:00

14 lines
472 B
TypeScript

/** A dyld byte name projected losslessly as UTF-8, or retained exactly. */
export type MachoName = string | { readonly bytes_base64: string };
/** NUL terminators and source bounds are validated by the owning format reader. */
export const decodeMachoName = (bytes: Buffer): MachoName => {
try {
return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(
bytes,
);
} catch {
return { bytes_base64: bytes.toString("base64") };
}
};