fix(managed): decode generic, array, fnptr, and modifier signatures (#1835)
* fix(managed): decode generic, array, fnptr, and modifier signatures Member signatures using GENERICINST, ARRAY, FNPTR, CMOD_REQD/CMOD_OPT, or TYPEDBYREF were reported as unsupported, leaving their types unknown and turning otherwise complete inspections partial. Decode them with an explicit stack so nested signatures stay recursion-free, keep encoded TypeDefOrRefOrSpec values, and report malformed shapes as malformed. Fixes #1832 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(managed): bound array rank before rendering dimensions Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(managed): keep modifier order and reject non-method fnptr headers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(managed): reject corrupt fnptr flags and misplaced typed references Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(managed): decode signature elements by grammar position Track whether each element is a field type, return type, parameter, nested Type, or pointee. VOID is valid only as a return type or pointee, TYPEDBYREF only as a return type or parameter, and BYREF only at the top of a return type, parameter, or ref field; other placements are malformed. Function pointer items are parsed as a return type then parameters, and generic arguments as Types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
069308bbe6
commit
1f531fc257
@@ -311,7 +311,7 @@ describe("managed member comparison of undecoded signatures", () => {
|
||||
it("pairs undecoded signatures by exact declared type, name, and raw bytes", () => {
|
||||
const undecoded = {
|
||||
methodSignature: Buffer.from([0x00, 0x00, 0x7f]),
|
||||
fieldSignature: Buffer.from([0x06, 0x15]),
|
||||
fieldSignature: Buffer.from([0x06, 0x7f]),
|
||||
};
|
||||
const left = inspect(
|
||||
buildManagedPeFixture(undecoded),
|
||||
@@ -346,7 +346,7 @@ describe("managed member comparison of undecoded signatures", () => {
|
||||
const left = inspect(
|
||||
buildManagedPeFixture({
|
||||
methodSignature: Buffer.from([0x00, 0x00, 0x7f]),
|
||||
fieldSignature: Buffer.from([0x06, 0x15]),
|
||||
fieldSignature: Buffer.from([0x06, 0x7f]),
|
||||
}),
|
||||
"/tmp/undecoded-before.dll",
|
||||
);
|
||||
@@ -374,7 +374,7 @@ describe("managed member comparison of undecoded signatures", () => {
|
||||
const right = inspect(
|
||||
buildManagedPeFixture({
|
||||
methodSignature: Buffer.from([0x00, 0x00, 0x7f]),
|
||||
fieldSignature: Buffer.from([0x06, 0x15]),
|
||||
fieldSignature: Buffer.from([0x06, 0x7f]),
|
||||
}),
|
||||
"/tmp/undecoded-after.dll",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user