Skip to content

Commit

Permalink
Test read suspicious after
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderOMara committed Jan 20, 2025
1 parent c1c61e9 commit c9098f1
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 @@ -218,6 +218,28 @@ Deno.test('open suspicious read align', async () => {
assertEquals(uni.isSuspicious(), true);
});

Deno.test('open suspicious read after', async () => {
const data = new ArrayBuffer(1024 + 1);
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 + 1;
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 c9098f1

Please sign in to comment.