fix(dotnet): bound RVA reads by section virtual size
Use the shared resolver for virtual containment, overlap checks, and file-backed extent. Raw alignment padding no longer supplies method bytes or shadows a later virtual section. Preserve malformed body coverage and suppress CIL hashes outside the admitted range. Verify zero, exact-end, truncated-body, padding, and true-overlap cases through compiled CLI and MCP consumers. Synthetic PE fixtures only; no Windows loader or real managed-provider verification. Fixes #1596. Supersedes #1595.
This commit is contained in:
@@ -32,6 +32,7 @@ interface ManagedPeFixtureOptions {
|
||||
readonly targetFramework?: string | null;
|
||||
readonly typeName?: string;
|
||||
readonly typeNamespace?: string;
|
||||
readonly virtualSectionSize?: number;
|
||||
}
|
||||
|
||||
const textEncoder = new TextEncoder();
|
||||
@@ -846,7 +847,8 @@ const buildManagedFixtureImage = (
|
||||
readyToRunOffset === null ? 0 : readyToRunOffset - 0x0200 + 4,
|
||||
) / 0x0200,
|
||||
) * 0x0200;
|
||||
const virtualSectionSize = Math.max(0x1000, rawSectionSize);
|
||||
const virtualSectionSize =
|
||||
options.virtualSectionSize ?? Math.max(0x1000, rawSectionSize);
|
||||
const image = Buffer.alloc(0x0200 + rawSectionSize);
|
||||
image.write("MZ", 0, "ascii");
|
||||
image.writeUInt32LE(0x80, 0x3c);
|
||||
|
||||
Reference in New Issue
Block a user