Skip to content

Commit 49c1a8c

Browse files
committed
test: account for [EnforceRange] in test-webcrypto-prototype-pollution
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
1 parent 2b7766e commit 49c1a8c

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

test/parallel/test-webcrypto-prototype-pollution.mjs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,15 @@ await withPoisoned(
265265
info: new Uint8Array(0),
266266
}, key, length);
267267

268-
// [EnforceRange] and [Clamp] are not set for a plain `unsigned long`, so
269-
// 2 ** 32 wraps to 0 rather than throwing or clamping.
268+
// deriveBits length is [EnforceRange], so 2 ** 32 must throw even when
269+
// conversion option properties are inherited from Object.prototype.
270270
for (const attribute of ['enforceRange', 'clamp']) {
271271
await withPoisoned(
272272
inherited(attribute, true),
273-
common.mustCall(async () => {
274-
assert.strictEqual((await hkdf(2 ** 32)).byteLength, 0);
275-
}));
273+
common.mustCall(() => assert.rejects(hkdf(2 ** 32), {
274+
code: 'ERR_OUT_OF_RANGE',
275+
name: 'TypeError',
276+
})));
276277
}
277278

278279
// [AllowResizable] is not set for BufferSource.

0 commit comments

Comments
 (0)