We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ce79c72 commit e880062Copy full SHA for e880062
1 file changed
test/parallel/test-internal-util-construct-sab.js
@@ -3,16 +3,20 @@
3
4
require('../common');
5
const assert = require('assert');
6
+const { kMaxLength } = require('buffer');
7
const { isSharedArrayBuffer } = require('util/types');
8
const { constructSharedArrayBuffer } = require('internal/util');
9
10
// We're testing that we can construct a SAB even when the global is not exposed.
11
assert.strictEqual(typeof SharedArrayBuffer, 'undefined');
12
-for (const length of [undefined, 0, 1, 2 ** 32]) {
13
+for (const length of [undefined, 0, 1, 2 ** 16]) {
14
assert(isSharedArrayBuffer(constructSharedArrayBuffer(length)));
15
}
16
-for (const length of [-1, Number.MAX_SAFE_INTEGER + 1, 2 ** 64]) {
17
+// Specifically test the following cases:
18
+// - out-of-range allocation requests should not crash the process
19
+// - no int64 overflow
20
+for (const length of [-1, kMaxLength + 1, 2 ** 64]) {
21
assert.throws(() => constructSharedArrayBuffer(length), RangeError);
22
0 commit comments