fix(managed): share first-match member ownership indexes

Resolve fields, methods, and attribute constructors through one budgeted index per layout. Preserve malformed-list first-match ownership without per-member TypeDef scans; remove the superseded lookup implementations.

Validate pointer identity and malformed ranges through production parsers, including a 40,000-type/method case and allocation admission. Managed source tests and CLI/MCP pointer acceptance pass. Refs #1953.
This commit is contained in:
morluto
2026-10-12 04:33:25 +08:00
parent 1449e8e051
commit 52e76c5d39
7 changed files with 259 additions and 267 deletions
+4 -3
View File
@@ -22,6 +22,7 @@ interface ManagedPeFixtureOptions {
readonly malformedCustomAttributeRows?: readonly number[];
readonly metadataExtraData?: number;
readonly metadataValidMaskExtra?: bigint;
readonly methodRowCount?: number;
readonly methodName?: string;
readonly methodFlags?: number;
readonly methodSignature?: Buffer;
@@ -604,7 +605,7 @@ const fixtureIndexWidths = ({
[1, 1],
[2, indexes.additionalTypeNames.length + 1],
[4, 1],
[6, 1],
[6, options.methodRowCount ?? 1],
[8, 0],
[10, 1],
[
@@ -707,7 +708,7 @@ const fixtureMetadataRows = ({
],
[
6,
[
repeatedRows(options.methodRowCount ?? 1, () =>
methodDefRow({
name: indexes.methodName,
signature: indexes.methodSignature,
@@ -719,7 +720,7 @@ const fixtureMetadataRows = ({
options.methodFlags ??
(options.pinvoke === undefined ? 0x0016 : 0x2016),
}),
],
),
],
[
10,