refactor(artifacts): share cached prefix reader and ELF/MZ magic (#13663)

refactor(filesystem/artifacts): share createCachedPrefixReader and ELF/MZ magic helpers
This commit is contained in:
morluto authored and GitHub committed 2026-11-22 22:27:07 +00:00
1 parent b14693914c
commit baed75fc2b
11 files changed
+76 -53

No files matched your search

+2 -2
View File
@@ -5,7 +5,7 @@ import {
declaredFileRange,
} from "../../domain/binaryContainer.js";
import { err, ok, type Result } from "../../domain/result.js";
import { parseMzHeaderEvidence } from "../../domain/dosMz.js";
import { hasDosMzMagic, parseMzHeaderEvidence } from "../../domain/dosMz.js";
import {
observePeCoffFrame,
PE_COFF_FRAME_BYTES,
@@ -730,7 +730,7 @@ const peClaims = async (
): Promise<readonly SectionWindow[]> => {
const { handle, fileSize, signal } = source;
const dos = await tryRead(handle, 0, 64, fileSize, signal);
if (dos === null || dos[0] !== 0x4d || dos[1] !== 0x5a) return [];
if (dos === null || !hasDosMzMagic(dos)) return [];
const probe = observePeCoffFrame(
dos,
fileSize,