mirror of
https://github.com/morluto/rea.git
synced 2026-11-09 16:26:36 +00:00
refactor(pe): share optional-header structural facts
Decode optional-header declarations once and pass detached directory words, locations and SizeOfHeaders to native consumers. Preserve executable machine admission, raw GPU/resource machine reporting, RVA mapping and certificate file-offset semantics. Validation: fresh build/catalog, full static checks, 466 core/provider fixture tests, 122 workflow tests and 14 selected file-backed PE admission tests passed. Public CLI and actual stdio MCP used authored artifacts; installed external providers were not qualified. Added 17 structural cases and two GPU machine-policy controls. Eager directory decoding costs remain unmeasured.
This commit is contained in:
1 parent
9548953b47
commit
599099f656
12 files changed
+394
-119
No files matched your search
@@ -1079,6 +1079,32 @@ it("retains an embedded CCOB with a corrupted signature as unsupported", async (
|
||||
}),
|
||||
);
|
||||
});
|
||||
it.each([
|
||||
["unknown COFF machine", 0xffff],
|
||||
["x86 machine with a PE32+ optional header", 0x14c],
|
||||
] as const)(
|
||||
"discovers PE GPU sections with %s",
|
||||
async (_description, machine) => {
|
||||
const bytes = peGpuFixture();
|
||||
const pe = bytes.readUInt32LE(60);
|
||||
bytes.writeUInt16LE(machine, pe + 4);
|
||||
const result = await inspect(bytes);
|
||||
if (!result.ok) throw result.error;
|
||||
expect(result.value.format).toBe("pe");
|
||||
expect(result.value.artifact.sha256).toBe(
|
||||
createHash("sha256").update(bytes).digest("hex"),
|
||||
);
|
||||
expect(result.value.coverage).toMatchObject({
|
||||
discovery: "complete",
|
||||
payloads: "complete",
|
||||
});
|
||||
expect(result.value.kernels.map(({ name }) => name)).toEqual([
|
||||
"add_one",
|
||||
"add_one",
|
||||
]);
|
||||
expect(result.value.ptx_artifacts[0]!.text).toBe(ptxFixture);
|
||||
},
|
||||
);
|
||||
it("does not dispatch a high-bit-corrupted DOS signature to the PE parser", async () => {
|
||||
const bytes = peGpuFixture(Buffer.from(ptxFixture));
|
||||
bytes[0] = bytes[0]! | 0x80;
|
||||
|
||||
Reference in new issue
Block a user