fix(managed): admit ReadyToRun images built for non-Windows hosts (#1985)
ReadyToRun images compiled for Linux, macOS or the BSDs store the COFF machine XORed with IMAGE_FILE_MACHINE_NATIVE_OS_OVERRIDE (dotnet/runtime src/coreclr/inc/pedecoder.h). Every framework assembly in a Linux .NET install has machine 0xFD1D, so target admission and the managed PE reader rejected them as an unsupported architecture. Decode the PE machine once in src/domain/peMachine.ts, replacing the two duplicated switches, and accept an OS override only on images with a CLI directory.
This commit is contained in:
@@ -46,6 +46,14 @@ describe("managed artifact failure classification", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("rejects a ReadyToRun OS-override machine without a CLI directory", () => {
|
||||
const bytes = buildNativePeFixture();
|
||||
bytes.writeUInt16LE(0x014c ^ 0x7b79, bytes.readUInt32LE(0x3c) + 4);
|
||||
expect(() =>
|
||||
inspectManagedArtifactBytes(bytes, managedPeFixtureTarget(bytes)),
|
||||
).toThrow("Unsupported PE machine 0x7a35");
|
||||
});
|
||||
|
||||
it("keeps malformed reference and attribute issues across inventory callers", () => {
|
||||
const bytes = buildManagedPeFixture({
|
||||
references: [
|
||||
|
||||
Reference in New Issue
Block a user