nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1diff --git a/test/parallel/test-internal-util-construct-sab.js b/test/parallel/test-internal-util-construct-sab.js
2index 5ff9b09f8e7d36..403b59809e47d2 100644
3--- a/test/parallel/test-internal-util-construct-sab.js
4+++ b/test/parallel/test-internal-util-construct-sab.js
5@@ -3,16 +3,20 @@
6
7 require('../common');
8 const assert = require('assert');
9+const { kMaxLength } = require('buffer');
10 const { isSharedArrayBuffer } = require('util/types');
11 const { constructSharedArrayBuffer } = require('internal/util');
12
13 // We're testing that we can construct a SAB even when the global is not exposed.
14 assert.strictEqual(typeof SharedArrayBuffer, 'undefined');
15
16-for (const length of [undefined, 0, 1, 2 ** 32]) {
17+for (const length of [undefined, 0, 1, 2 ** 16]) {
18 assert(isSharedArrayBuffer(constructSharedArrayBuffer(length)));
19 }
20
21-for (const length of [-1, Number.MAX_SAFE_INTEGER + 1, 2 ** 64]) {
22+// Specifically test the following cases:
23+// - out-of-range allocation requests should not crash the process
24+// - no int64 overflow
25+for (const length of [-1, kMaxLength + 1, 2 ** 64]) {
26 assert.throws(() => constructSharedArrayBuffer(length), RangeError);
27 }