refactor: consolidate binary analysis admission and format ownership

Reuse the existing provider input admission helper across twelve services,
preserving cancellation, schema errors, path policies, and Evidence handling.
Share ELF dynamic records across Dart, MIPS, and IL2CPP readers, and reuse
Mach-O segment and section records for Node SEA location.

Require canonical DOS ownership before GPU PE section discovery so relocation
bytes cannot masquerade as a PE pointer. Cover valid short DOS headers and
the malformed case through both inventory and the public CLI.
This commit is contained in:
morluto committed 2026-10-26 16:44:21 +08:00
1 parent 7adfcc4467
commit 6336fe5bb5
23 files changed
+482 -270

No files matched your search

+9 -2
View File
@@ -1,3 +1,4 @@
import { readElfDynamicEntry } from "../domain/elfDynamicEntry.js";
import {
BinaryMappingFailure,
mappedFileOffset,
@@ -113,11 +114,17 @@ function* dynamicTags(
]);
for (let at = dynamic.offset; at < dynamic.offset + dynamic.size; at += 16) {
if ((at - dynamic.offset) % 65536 === 0) yield;
const tag = image.readBigInt64LE(at);
const parsedEntry = readElfDynamicEntry(
image.subarray(at, at + 16),
64,
true,
);
if (!parsedEntry.ok) throw malformed(parsedEntry.error.message);
const { tag, value } = parsedEntry.value;
if (tag === 0n) return tags;
if (tags.has(tag) && unique.has(tag))
throw malformed(`duplicate dynamic tag ${tag}`);
tags.set(tag, image.readBigUInt64LE(at + 8));
tags.set(tag, value);
}
throw malformed("PT_DYNAMIC has no DT_NULL terminator");
}