fix(elf): centralize fixed header validation across consumers

Validate ELF identification/header versions and declared header bounds at the shared owner. Reuse parsed facts in target selection, Go, Dart and MIPS readers while preserving their stricter format policies and x32 support.

Repair synthetic ELF fixtures and remove a superseded Go error-text assertion. Validation: 74 source tests, 202 filesystem/Go/MIPS boundary tests, typecheck and lint. No new real-provider claims.
This commit is contained in:
morluto
2026-10-13 08:07:58 +08:00
parent f09bb8a997
commit 34a4bb6508
12 changed files with 205 additions and 59 deletions
+7
View File
@@ -26,6 +26,13 @@ describe("executable header parsing", () => {
expect(result.ok && result.value).toMatchObject({ format, architecture });
});
it("retains ELF32 x86-64 identity for the x32 ABI", () => {
expect(parseExecutableHeader(elf(1, 1, 62), "x64")).toMatchObject({
ok: true,
value: { format: "elf", architecture: "x86_64" },
});
});
it("distinguishes native PE applications, DLLs, and managed assemblies", () => {
const application = parseExecutableHeader(pe(0x8664), "x64");
const library = parseExecutableHeader(pe(0x8664, 64, 0x2002), "x64");