refactor(elf): share fixed header declaration widths (#12391)

This commit is contained in:
morluto authored and GitHub committed 2026-11-19 15:59:06 +00:00
1 parent ad996352c3
commit 1ba93c8a1b
18 files changed
+184 -96

No files matched your search

+6 -2
View File
@@ -17,7 +17,11 @@ it.each(formats)(
const wide = bits === 64;
const length = wide ? 56 : 32;
const backing = Buffer.alloc(length + 19, 0xa5);
const bytes = backing.subarray(7, 7 + length);
const bytes = new Uint8Array(
backing.buffer,
backing.byteOffset + 7,
length,
);
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
const values = wide
? [
@@ -45,7 +49,7 @@ it.each(formats)(
});
const before = Buffer.from(backing);
const parsed = readElfProgramHeader(
backing.subarray(7),
new Uint8Array(backing.buffer, bytes.byteOffset, length + 5),
bits,
littleEndian,
);