Skip to content

Commit

Permalink
Open cover bad magic
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderOMara committed Jan 19, 2025
1 parent 662fe09 commit 3d80f44
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions macho/universal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ Deno.test('open under header', async () => {
);
});

Deno.test('open unknown magic', async () => {
const data = new ArrayBuffer(
Math.max(FatHeader.BYTE_LENGTH, MachHeader.BYTE_LENGTH),
);
const blob = new Blob([data]);
const uni = new Universal();
await assertRejects(
() => uni.open(blob),
RangeError,
'Unknown magic: 0x0',
);
});

Deno.test('open under arch', async () => {
const data = new ArrayBuffer(
Math.max(FatHeader.BYTE_LENGTH, MachHeader.BYTE_LENGTH),
Expand Down

0 comments on commit 3d80f44

Please sign in to comment.