From f0be628be6ba03688b97d3f56cbb5f154c85e789 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 19 Oct 2026 20:50:04 +0200 Subject: [PATCH] cultmesh-browser: the unallocatable-size test uses chunks an int can hold The owner now refuses a chunk past 2147483647, so the oversize manifest is 32768 chunks of that size (about 64 TiB) instead of one 2^53 - 1 chunk. Co-Authored-By: Claude Opus 5.5 --- packages/cultmesh-browser/test/content.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/cultmesh-browser/test/content.test.ts b/packages/cultmesh-browser/test/content.test.ts index 8c6767db..cc0bb322 100644 --- a/packages/cultmesh-browser/test/content.test.ts +++ b/packages/cultmesh-browser/test/content.test.ts @@ -562,7 +562,10 @@ test("an abort that lands while the last bytes are hashed rejects with its reaso test("a size the runtime cannot allocate is too-large in both exports, not a RangeError, and nothing is requested", async () => { const { manifest } = await pack(10, 10); const size = Number.MAX_SAFE_INTEGER; - const huge = { ...manifest, sizeBytes: size, chunks: [{ ...manifest.chunks[0]!, offset: 0, sizeBytes: size }] }; + // chunks are ints, so a manifest this large is many of them: 32768 of 2147483647 bytes is about 64 TiB + const int32Max = 2 ** 31 - 1; + const count = 2 ** 15; + const huge = { ...manifest, sizeBytes: count * int32Max, chunks: Array.from({ length: count }, (_, index) => ({ ...manifest.chunks[0]!, offset: index * int32Max, sizeBytes: int32Max })) }; const server = double(() => { throw new Error("no request expected"); }); await assert.rejects(fetchVerifiedContent(ENDPOINT, huge, { fetch: server.fetch, maxBytes: size }), codeOf("too-large")); await assert.rejects(fetchVerifiedChunk(ENDPOINT, manifest.chunks[0]!.chunkHash!, size, { fetch: server.fetch, maxBytes: size }), codeOf("too-large"));