Skip to content

Commit

Permalink
Test read suspicious alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderOMara committed Jan 20, 2025
1 parent 409a1c9 commit c1c61e9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions macho/universal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,28 @@ Deno.test('open suspicious gap', async () => {
assertEquals(uni.isSuspicious(), true);
});

Deno.test('open suspicious read align', async () => {
const data = new ArrayBuffer(1024);
const header = new FatHeader(data);
header.magic = FAT_MAGIC;
header.nfatArch = 2;

const arch1 = new FatArch(data, header.byteLength);
arch1.offset = 256;
arch1.size = 256;
arch1.align = 8;

const arch2 = new FatArch(data, header.byteLength + arch1.byteLength);
arch2.offset = 256 * 3;
arch2.size = 256;
arch2.align = 8;

const blob = new Blob([data]);
const uni = new Universal();
await uni.open(blob);
assertEquals(uni.isSuspicious(), true);
});

Deno.test('open suspicious read error', async () => {
const data = new ArrayBuffer(512 + 1);
const header = new FatHeader(data);
Expand Down

0 comments on commit c1c61e9

Please sign in to comment.