fix(managed): classify truncated signatures as malformed (#598)

* fix(managed): classify truncated signatures as malformed

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>

* fix(managed): use typed signature parsing failures

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>

* chore(managed): refresh signature schema commitments

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>

---------

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
This commit is contained in:
Rudy Mizrahi Celekli
2026-10-06 02:08:02 +08:00
committed by GitHub
parent 5daaa453ff
commit 1b6f05470d
7 changed files with 86 additions and 13 deletions
+36
View File
@@ -110,3 +110,39 @@ describe("managed member inspection", () => {
expect(result.coverage).toMatchObject({ state: "complete", issues: [] });
});
});
it.each([
Buffer.alloc(0),
Buffer.from([0]),
Buffer.from([0, 0, 0x12]),
Buffer.from([0x10, 0x80]),
Buffer.from([0, 0xe0]),
])(
"marks incomplete or reserved method signatures malformed: %j",
(methodSignature) => {
const bytes = buildManagedPeFixture({ methodSignature });
const result = inspectManagedMembersBytes(
bytes,
managedPeFixtureTarget(bytes),
);
expect(result.methods[0]?.signature).toMatchObject({
parse_status: "malformed",
kind: "unknown",
});
},
);
it("keeps an admitted but unimplemented element type unsupported", () => {
// ECMA-335 ELEMENT_TYPE_ARRAY is valid, but multidimensional arrays are not decoded here.
const bytes = buildManagedPeFixture({
fieldSignature: Buffer.from([6, 0x14, 8, 1, 0, 0]),
});
const result = inspectManagedMembersBytes(
bytes,
managedPeFixtureTarget(bytes),
);
expect(result.fields[0]?.signature).toMatchObject({
parse_status: "unsupported",
issue: "unsupported element type 0x14",
});
});